From fbc661c054eaa4ecdfcf6e175feb3e1716747e45 Mon Sep 17 00:00:00 2001 From: willclarktech Date: Wed, 21 Oct 2020 14:19:35 +0200 Subject: [PATCH 01/28] launchpad: Rename OfflineSigner.sign -> signAmino --- .../src/cosmosclient.searchtx.spec.ts | 2 +- packages/launchpad/src/cosmosclient.spec.ts | 2 +- .../launchpad/src/lcdapi/distribution.spec.ts | 2 +- packages/launchpad/src/lcdapi/gov.spec.ts | 4 ++-- .../launchpad/src/lcdapi/lcdclient.spec.ts | 24 +++++++++---------- packages/launchpad/src/lcdapi/staking.spec.ts | 4 ++-- .../launchpad/src/secp256k1hdwallet.spec.ts | 4 ++-- packages/launchpad/src/secp256k1hdwallet.ts | 2 +- packages/launchpad/src/signer.ts | 2 +- packages/launchpad/src/signingcosmosclient.ts | 2 +- .../launchpad/types/secp256k1hdwallet.d.ts | 2 +- packages/launchpad/types/signer.d.ts | 4 ++-- 12 files changed, 27 insertions(+), 27 deletions(-) diff --git a/packages/launchpad/src/cosmosclient.searchtx.spec.ts b/packages/launchpad/src/cosmosclient.searchtx.spec.ts index dbdfcb3b..5f5aa775 100644 --- a/packages/launchpad/src/cosmosclient.searchtx.spec.ts +++ b/packages/launchpad/src/cosmosclient.searchtx.spec.ts @@ -56,7 +56,7 @@ describe("CosmosClient.searchTx", () => { const { accountNumber, sequence } = await client.getSequence(); const chainId = await client.getChainId(); const signDoc = makeSignDoc([sendMsg], fee, chainId, memo, accountNumber, sequence); - const { signed, signature } = await wallet.sign(walletAddress, signDoc); + const { signed, signature } = await wallet.signAmino(walletAddress, signDoc); const tx: WrappedStdTx = { type: "cosmos-sdk/StdTx", value: makeStdTx(signed, signature), diff --git a/packages/launchpad/src/cosmosclient.spec.ts b/packages/launchpad/src/cosmosclient.spec.ts index 70305145..dc621fd4 100644 --- a/packages/launchpad/src/cosmosclient.spec.ts +++ b/packages/launchpad/src/cosmosclient.spec.ts @@ -232,7 +232,7 @@ describe("CosmosClient", () => { const chainId = await client.getChainId(); const { accountNumber, sequence } = await client.getSequence(faucet.address); const signDoc = makeSignDoc([sendMsg], fee, chainId, memo, accountNumber, sequence); - const { signed, signature } = await wallet.sign(walletAddress, signDoc); + const { signed, signature } = await wallet.signAmino(walletAddress, signDoc); const signedTx = makeStdTx(signed, signature); const txResult = await client.broadcastTx(signedTx); assertIsBroadcastTxSuccess(txResult); diff --git a/packages/launchpad/src/lcdapi/distribution.spec.ts b/packages/launchpad/src/lcdapi/distribution.spec.ts index d7b36ae6..ec5016fb 100644 --- a/packages/launchpad/src/lcdapi/distribution.spec.ts +++ b/packages/launchpad/src/lcdapi/distribution.spec.ts @@ -47,7 +47,7 @@ describe("DistributionExtension", () => { const memo = "Test delegation for wasmd"; const { accountNumber, sequence } = await client.getSequence(); const signDoc = makeSignDoc([msg], defaultFee, chainId, memo, accountNumber, sequence); - const { signed, signature } = await wallet.sign(faucet.address, signDoc); + const { signed, signature } = await wallet.signAmino(faucet.address, signDoc); const signedTx = makeStdTx(signed, signature); const result = await client.broadcastTx(signedTx); diff --git a/packages/launchpad/src/lcdapi/gov.spec.ts b/packages/launchpad/src/lcdapi/gov.spec.ts index f21955c0..38226377 100644 --- a/packages/launchpad/src/lcdapi/gov.spec.ts +++ b/packages/launchpad/src/lcdapi/gov.spec.ts @@ -58,7 +58,7 @@ describe("GovExtension", () => { proposalAccountNumber, proposalSequence, ); - const { signature: proposalSignature } = await wallet.sign(faucet.address, proposalSignDoc); + const { signature: proposalSignature } = await wallet.signAmino(faucet.address, proposalSignDoc); const proposalTx = { msg: [proposalMsg], fee: defaultFee, @@ -90,7 +90,7 @@ describe("GovExtension", () => { voteAccountNumber, voteSequence, ); - const { signature: voteSignature } = await wallet.sign(faucet.address, voteSignDoc); + const { signature: voteSignature } = await wallet.signAmino(faucet.address, voteSignDoc); const voteTx = { msg: [voteMsg], fee: defaultFee, diff --git a/packages/launchpad/src/lcdapi/lcdclient.spec.ts b/packages/launchpad/src/lcdapi/lcdclient.spec.ts index 3e1fbf85..9736b24b 100644 --- a/packages/launchpad/src/lcdapi/lcdclient.spec.ts +++ b/packages/launchpad/src/lcdapi/lcdclient.spec.ts @@ -240,7 +240,7 @@ describe("LcdClient", () => { const { accountNumber, sequence } = await client.getSequence(); const chainId = await client.getChainId(); const signDoc = makeSignDoc([sendMsg], fee, chainId, memo, accountNumber, sequence); - const { signed, signature } = await wallet.sign(walletAddress, signDoc); + const { signed, signature } = await wallet.signAmino(walletAddress, signDoc); const signedTx = makeStdTx(signed, signature); const transactionId = await client.getIdentifier({ type: "cosmos-sdk/StdTx", value: signedTx }); const result = await client.broadcastTx(signedTx); @@ -534,7 +534,7 @@ describe("LcdClient", () => { const { account_number, sequence } = (await client.auth.account(faucet.address)).result.value; const signDoc = makeSignDoc([theMsg], fee, wasmd.chainId, memo, account_number, sequence); - const { signed, signature } = await wallet.sign(walletAddress, signDoc); + const { signed, signature } = await wallet.signAmino(walletAddress, signDoc); const signedTx = makeStdTx(signed, signature); const result = await client.broadcastTx(signedTx); expect(result.code).toBeUndefined(); @@ -593,9 +593,9 @@ describe("LcdClient", () => { const signDoc1 = makeSignDoc([theMsg], fee, wasmd.chainId, memo, an1, sequence1); const signDoc2 = makeSignDoc([theMsg], fee, wasmd.chainId, memo, an2, sequence2); const signDoc3 = makeSignDoc([theMsg], fee, wasmd.chainId, memo, an3, sequence3); - const { signature: signature1 } = await account1.sign(address1, signDoc1); - const { signature: signature2 } = await account2.sign(address2, signDoc2); - const { signature: signature3 } = await account3.sign(address3, signDoc3); + const { signature: signature1 } = await account1.signAmino(address1, signDoc1); + const { signature: signature2 } = await account2.signAmino(address2, signDoc2); + const { signature: signature3 } = await account3.signAmino(address3, signDoc3); const signedTx: StdTx = { msg: [theMsg], fee: fee, @@ -655,7 +655,7 @@ describe("LcdClient", () => { const { account_number, sequence } = (await client.auth.account(walletAddress)).result.value; const signDoc = makeSignDoc([msg1, msg2], fee, wasmd.chainId, memo, account_number, sequence); - const { signed, signature } = await wallet.sign(walletAddress, signDoc); + const { signed, signature } = await wallet.signAmino(walletAddress, signDoc); const signedTx = makeStdTx(signed, signature); const broadcastResult = await client.broadcastTx(signedTx); expect(broadcastResult.code).toBeUndefined(); @@ -715,8 +715,8 @@ describe("LcdClient", () => { const signDoc1 = makeSignDoc([msg2, msg1], fee, wasmd.chainId, memo, an1, sequence1); const signDoc2 = makeSignDoc([msg2, msg1], fee, wasmd.chainId, memo, an2, sequence2); - const { signature: signature1 } = await account1.sign(address1, signDoc1); - const { signature: signature2 } = await account2.sign(address2, signDoc2); + const { signature: signature1 } = await account1.signAmino(address1, signDoc1); + const { signature: signature2 } = await account2.signAmino(address2, signDoc2); const signedTx: StdTx = { msg: [msg2, msg1], fee: fee, @@ -786,8 +786,8 @@ describe("LcdClient", () => { const signDoc1 = makeSignDoc([msg1, msg2], fee, wasmd.chainId, memo, an1, sequence1); const signDoc2 = makeSignDoc([msg1, msg2], fee, wasmd.chainId, memo, an2, sequence2); - const { signature: signature1 } = await account1.sign(address1, signDoc1); - const { signature: signature2 } = await account2.sign(address2, signDoc2); + const { signature: signature1 } = await account1.signAmino(address1, signDoc1); + const { signature: signature2 } = await account2.signAmino(address2, signDoc2); const signedTx: StdTx = { msg: [msg1, msg2], fee: fee, @@ -852,8 +852,8 @@ describe("LcdClient", () => { const signDoc1 = makeSignDoc([msg2, msg1], fee, wasmd.chainId, memo, an1, sequence1); const signDoc2 = makeSignDoc([msg2, msg1], fee, wasmd.chainId, memo, an2, sequence2); - const { signature: signature1 } = await account1.sign(address1, signDoc1); - const { signature: signature2 } = await account2.sign(address2, signDoc2); + const { signature: signature1 } = await account1.signAmino(address1, signDoc1); + const { signature: signature2 } = await account2.signAmino(address2, signDoc2); const signedTx: StdTx = { msg: [msg2, msg1], fee: fee, diff --git a/packages/launchpad/src/lcdapi/staking.spec.ts b/packages/launchpad/src/lcdapi/staking.spec.ts index 18feea20..c9d9c189 100644 --- a/packages/launchpad/src/lcdapi/staking.spec.ts +++ b/packages/launchpad/src/lcdapi/staking.spec.ts @@ -48,7 +48,7 @@ describe("StakingExtension", () => { const memo = "Test delegation for wasmd"; const { accountNumber, sequence } = await client.getSequence(); const signDoc = makeSignDoc([msg], defaultFee, chainId, memo, accountNumber, sequence); - const { signed, signature } = await wallet.sign(faucet.address, signDoc); + const { signed, signature } = await wallet.signAmino(faucet.address, signDoc); const signedTx = makeStdTx(signed, signature); const result = await client.broadcastTx(signedTx); @@ -66,7 +66,7 @@ describe("StakingExtension", () => { const memo = "Test undelegation for wasmd"; const { accountNumber, sequence } = await client.getSequence(); const signDoc = makeSignDoc([msg], defaultFee, chainId, memo, accountNumber, sequence); - const { signed, signature } = await wallet.sign(faucet.address, signDoc); + const { signed, signature } = await wallet.signAmino(faucet.address, signDoc); const signedTx = makeStdTx(signed, signature); const result = await client.broadcastTx(signedTx); diff --git a/packages/launchpad/src/secp256k1hdwallet.spec.ts b/packages/launchpad/src/secp256k1hdwallet.spec.ts index 0354365e..90213da1 100644 --- a/packages/launchpad/src/secp256k1hdwallet.spec.ts +++ b/packages/launchpad/src/secp256k1hdwallet.spec.ts @@ -109,7 +109,7 @@ describe("Secp256k1HdWallet", () => { }); }); - describe("sign", () => { + describe("signAmino", () => { it("resolves to valid signature", async () => { const wallet = await Secp256k1HdWallet.fromMnemonic(defaultMnemonic); const signDoc: StdSignDoc = { @@ -120,7 +120,7 @@ describe("Secp256k1HdWallet", () => { account_number: "7", sequence: "54", }; - const { signed, signature } = await wallet.sign(defaultAddress, signDoc); + const { signed, signature } = await wallet.signAmino(defaultAddress, signDoc); expect(signed).toEqual(signDoc); const valid = await Secp256k1.verifySignature( Secp256k1Signature.fromFixedLength(fromBase64(signature.signature)), diff --git a/packages/launchpad/src/secp256k1hdwallet.ts b/packages/launchpad/src/secp256k1hdwallet.ts index 32e44569..1758b08e 100644 --- a/packages/launchpad/src/secp256k1hdwallet.ts +++ b/packages/launchpad/src/secp256k1hdwallet.ts @@ -259,7 +259,7 @@ export class Secp256k1HdWallet implements OfflineSigner { ]; } - public async sign(signerAddress: string, signDoc: StdSignDoc): Promise { + public async signAmino(signerAddress: string, signDoc: StdSignDoc): Promise { if (signerAddress !== this.address) { throw new Error(`Address ${signerAddress} not found in wallet`); } diff --git a/packages/launchpad/src/signer.ts b/packages/launchpad/src/signer.ts index f7218bb1..c5d88261 100644 --- a/packages/launchpad/src/signer.ts +++ b/packages/launchpad/src/signer.ts @@ -34,5 +34,5 @@ export interface OfflineSigner { * @param signerAddress The address of the account that should sign the transaction * @param signDoc The content that should be signed */ - readonly sign: (signerAddress: string, signDoc: StdSignDoc) => Promise; + readonly signAmino: (signerAddress: string, signDoc: StdSignDoc) => Promise; } diff --git a/packages/launchpad/src/signingcosmosclient.ts b/packages/launchpad/src/signingcosmosclient.ts index 77090274..5a1cb373 100644 --- a/packages/launchpad/src/signingcosmosclient.ts +++ b/packages/launchpad/src/signingcosmosclient.ts @@ -90,7 +90,7 @@ export class SigningCosmosClient extends CosmosClient { const { accountNumber, sequence } = await this.getSequence(); const chainId = await this.getChainId(); const signDoc = makeSignDoc(msgs, fee, chainId, memo, accountNumber, sequence); - const { signed, signature } = await this.signer.sign(this.senderAddress, signDoc); + const { signed, signature } = await this.signer.signAmino(this.senderAddress, signDoc); const signedTx = makeStdTx(signed, signature); return this.broadcastTx(signedTx); } diff --git a/packages/launchpad/types/secp256k1hdwallet.d.ts b/packages/launchpad/types/secp256k1hdwallet.d.ts index 7d3cbe00..a638708f 100644 --- a/packages/launchpad/types/secp256k1hdwallet.d.ts +++ b/packages/launchpad/types/secp256k1hdwallet.d.ts @@ -70,7 +70,7 @@ export declare class Secp256k1HdWallet implements OfflineSigner { get mnemonic(): string; private get address(); getAccounts(): Promise; - sign(signerAddress: string, signDoc: StdSignDoc): Promise; + signAmino(signerAddress: string, signDoc: StdSignDoc): Promise; /** * Generates an encrypted serialization of this wallet. * diff --git a/packages/launchpad/types/signer.d.ts b/packages/launchpad/types/signer.d.ts index e0e8d1a8..783c4299 100644 --- a/packages/launchpad/types/signer.d.ts +++ b/packages/launchpad/types/signer.d.ts @@ -7,7 +7,7 @@ export interface AccountData { readonly algo: Algo; readonly pubkey: Uint8Array; } -export interface SignResponse { +export interface AminoSignResponse { /** * The sign doc that was signed. * This may be different from the input signDoc when the signer modifies it as part of the signing process. @@ -29,5 +29,5 @@ export interface OfflineSigner { * @param signerAddress The address of the account that should sign the transaction * @param signDoc The content that should be signed */ - readonly sign: (signerAddress: string, signDoc: StdSignDoc) => Promise; + readonly signAmino: (signerAddress: string, signDoc: StdSignDoc) => Promise; } From e9de27d7ee592da01bb3231c10ca2f7e0517cb26 Mon Sep 17 00:00:00 2001 From: willclarktech Date: Wed, 21 Oct 2020 14:30:08 +0200 Subject: [PATCH 02/28] launchpad: Rename SignResponse -> AminoSignResponse --- packages/launchpad/src/index.ts | 2 +- packages/launchpad/src/secp256k1hdwallet.ts | 4 ++-- packages/launchpad/src/signer.ts | 4 ++-- packages/launchpad/types/index.d.ts | 2 +- packages/launchpad/types/secp256k1hdwallet.d.ts | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/launchpad/src/index.ts b/packages/launchpad/src/index.ts index fb3cd0a8..2b264517 100644 --- a/packages/launchpad/src/index.ts +++ b/packages/launchpad/src/index.ts @@ -111,7 +111,7 @@ export { } from "./pubkey"; export { findSequenceForSignedTx } from "./sequence"; export { encodeSecp256k1Signature, decodeSignature } from "./signature"; -export { AccountData, Algo, OfflineSigner, SignResponse } from "./signer"; +export { AccountData, Algo, AminoSignResponse, OfflineSigner } from "./signer"; export { CosmosFeeTable, SigningCosmosClient } from "./signingcosmosclient"; export { isStdTx, isWrappedStdTx, makeStdTx, CosmosSdkTx, StdTx, WrappedStdTx, WrappedTx } from "./tx"; export { pubkeyType, PubKey, StdFee, StdSignature } from "./types"; diff --git a/packages/launchpad/src/secp256k1hdwallet.ts b/packages/launchpad/src/secp256k1hdwallet.ts index 1758b08e..2f4d94ca 100644 --- a/packages/launchpad/src/secp256k1hdwallet.ts +++ b/packages/launchpad/src/secp256k1hdwallet.ts @@ -16,7 +16,7 @@ import { assert, isNonNullObject } from "@cosmjs/utils"; import { rawSecp256k1PubkeyToAddress } from "./address"; import { serializeSignDoc, StdSignDoc } from "./encoding"; import { encodeSecp256k1Signature } from "./signature"; -import { AccountData, OfflineSigner, SignResponse } from "./signer"; +import { AccountData, AminoSignResponse, OfflineSigner } from "./signer"; import { decrypt, encrypt, @@ -259,7 +259,7 @@ export class Secp256k1HdWallet implements OfflineSigner { ]; } - public async signAmino(signerAddress: string, signDoc: StdSignDoc): Promise { + public async signAmino(signerAddress: string, signDoc: StdSignDoc): Promise { if (signerAddress !== this.address) { throw new Error(`Address ${signerAddress} not found in wallet`); } diff --git a/packages/launchpad/src/signer.ts b/packages/launchpad/src/signer.ts index c5d88261..57b9829c 100644 --- a/packages/launchpad/src/signer.ts +++ b/packages/launchpad/src/signer.ts @@ -10,7 +10,7 @@ export interface AccountData { readonly pubkey: Uint8Array; } -export interface SignResponse { +export interface AminoSignResponse { /** * The sign doc that was signed. * This may be different from the input signDoc when the signer modifies it as part of the signing process. @@ -34,5 +34,5 @@ export interface OfflineSigner { * @param signerAddress The address of the account that should sign the transaction * @param signDoc The content that should be signed */ - readonly signAmino: (signerAddress: string, signDoc: StdSignDoc) => Promise; + readonly signAmino: (signerAddress: string, signDoc: StdSignDoc) => Promise; } diff --git a/packages/launchpad/types/index.d.ts b/packages/launchpad/types/index.d.ts index 6580a9a2..8b312aae 100644 --- a/packages/launchpad/types/index.d.ts +++ b/packages/launchpad/types/index.d.ts @@ -109,7 +109,7 @@ export { } from "./pubkey"; export { findSequenceForSignedTx } from "./sequence"; export { encodeSecp256k1Signature, decodeSignature } from "./signature"; -export { AccountData, Algo, OfflineSigner, SignResponse } from "./signer"; +export { AccountData, Algo, AminoSignResponse, OfflineSigner } from "./signer"; export { CosmosFeeTable, SigningCosmosClient } from "./signingcosmosclient"; export { isStdTx, isWrappedStdTx, makeStdTx, CosmosSdkTx, StdTx, WrappedStdTx, WrappedTx } from "./tx"; export { pubkeyType, PubKey, StdFee, StdSignature } from "./types"; diff --git a/packages/launchpad/types/secp256k1hdwallet.d.ts b/packages/launchpad/types/secp256k1hdwallet.d.ts index a638708f..9a3be009 100644 --- a/packages/launchpad/types/secp256k1hdwallet.d.ts +++ b/packages/launchpad/types/secp256k1hdwallet.d.ts @@ -1,6 +1,6 @@ import { HdPath } from "@cosmjs/crypto"; import { StdSignDoc } from "./encoding"; -import { AccountData, OfflineSigner, SignResponse } from "./signer"; +import { AccountData, AminoSignResponse, OfflineSigner } from "./signer"; import { EncryptionConfiguration, KdfConfiguration } from "./wallet"; /** * This interface describes a JSON object holding the encrypted wallet and the meta data. @@ -70,7 +70,7 @@ export declare class Secp256k1HdWallet implements OfflineSigner { get mnemonic(): string; private get address(); getAccounts(): Promise; - signAmino(signerAddress: string, signDoc: StdSignDoc): Promise; + signAmino(signerAddress: string, signDoc: StdSignDoc): Promise; /** * Generates an encrypted serialization of this wallet. * From 5b5a173f5a93d23799b657ea1e68f36a4a04db3a Mon Sep 17 00:00:00 2001 From: willclarktech Date: Wed, 21 Oct 2020 16:07:05 +0200 Subject: [PATCH 03/28] proto-signing: Add OfflineSigner and OfflineDirectSigner types --- packages/proto-signing/src/signer.ts | 22 ++++++++++++++++++++++ packages/proto-signing/types/signer.d.ts | 18 ++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 packages/proto-signing/src/signer.ts create mode 100644 packages/proto-signing/types/signer.d.ts diff --git a/packages/proto-signing/src/signer.ts b/packages/proto-signing/src/signer.ts new file mode 100644 index 00000000..a5aca75b --- /dev/null +++ b/packages/proto-signing/src/signer.ts @@ -0,0 +1,22 @@ +import { AccountData, OfflineSigner as OfflineAminoSigner, StdSignature } from "@cosmjs/launchpad"; + +import { cosmos } from "./codec"; + +export interface DirectSignResponse { + /** + * The sign doc that was signed. + * This may be different from the input signDoc when the signer modifies it as part of the signing process. + */ + readonly signed: cosmos.tx.v1beta1.ISignDoc; + readonly signature: StdSignature; +} + +export interface OfflineDirectSigner { + readonly getAccounts: () => Promise; + readonly signDirect: ( + signerAddress: string, + signDoc: cosmos.tx.v1beta1.ISignDoc, + ) => Promise; +} + +export type OfflineSigner = OfflineAminoSigner | OfflineDirectSigner; diff --git a/packages/proto-signing/types/signer.d.ts b/packages/proto-signing/types/signer.d.ts new file mode 100644 index 00000000..dc2d9e98 --- /dev/null +++ b/packages/proto-signing/types/signer.d.ts @@ -0,0 +1,18 @@ +import { AccountData, OfflineSigner as OfflineAminoSigner, StdSignature } from "@cosmjs/launchpad"; +import { cosmos } from "./codec"; +export interface DirectSignResponse { + /** + * The sign doc that was signed. + * This may be different from the input signDoc when the signer modifies it as part of the signing process. + */ + readonly signed: cosmos.tx.v1beta1.ISignDoc; + readonly signature: StdSignature; +} +export interface OfflineDirectSigner { + readonly getAccounts: () => Promise; + readonly signDirect: ( + signerAddress: string, + signDoc: cosmos.tx.v1beta1.ISignDoc, + ) => Promise; +} +export declare type OfflineSigner = OfflineAminoSigner | OfflineDirectSigner; From f1c081a7d0076b1067a3d1407d3bcad7859ba4ce Mon Sep 17 00:00:00 2001 From: willclarktech Date: Wed, 21 Oct 2020 16:09:31 +0200 Subject: [PATCH 04/28] proto-signing: Update for new OfflineSigner types --- .../src/directsecp256k1wallet.spec.ts | 33 ++++++++--- .../src/directsecp256k1wallet.ts | 18 ++++-- packages/proto-signing/src/index.ts | 3 +- packages/proto-signing/src/signing.spec.ts | 58 +++++-------------- packages/proto-signing/src/signing.ts | 24 ++++---- packages/proto-signing/src/testutils.spec.ts | 46 +++++++++++++++ .../types/directsecp256k1wallet.d.ts | 8 ++- packages/proto-signing/types/index.d.ts | 3 +- packages/proto-signing/types/signing.d.ts | 16 ++--- 9 files changed, 126 insertions(+), 83 deletions(-) diff --git a/packages/proto-signing/src/directsecp256k1wallet.spec.ts b/packages/proto-signing/src/directsecp256k1wallet.spec.ts index 80e4f266..732875f1 100644 --- a/packages/proto-signing/src/directsecp256k1wallet.spec.ts +++ b/packages/proto-signing/src/directsecp256k1wallet.spec.ts @@ -1,7 +1,11 @@ import { Secp256k1, Secp256k1Signature, sha256 } from "@cosmjs/crypto"; -import { fromBase64, fromHex, toAscii } from "@cosmjs/encoding"; +import { fromBase64, fromHex } from "@cosmjs/encoding"; +import { coins } from "@cosmjs/launchpad"; +import Long from "long"; import { DirectSecp256k1Wallet } from "./directsecp256k1wallet"; +import { makeAuthInfoBytes, makeSignBytes } from "./signing"; +import { faucet, testVectors } from "./testutils.spec"; describe("DirectSecp256k1Wallet", () => { // m/44'/118'/0'/0/0 @@ -54,15 +58,28 @@ describe("DirectSecp256k1Wallet", () => { }); }); - describe("sign", () => { + describe("signDirect", () => { it("resolves to valid signature", async () => { - const wallet = await DirectSecp256k1Wallet.fromMnemonic(defaultMnemonic); - const message = toAscii("foo bar"); - const signature = await wallet.sign(defaultAddress, message); + const { sequence, bodyBytes } = testVectors[1]; + const wallet = await DirectSecp256k1Wallet.fromMnemonic(faucet.mnemonic); + const pubkey = { + typeUrl: "/cosmos.crypto.secp256k1.PubKey", + value: fromBase64(faucet.pubkey.value), + }; + const fee = coins(2000, "ucosm"); + const gasLimit = 200000; + const signDoc = { + bodyBytes: fromHex(bodyBytes), + authInfoBytes: makeAuthInfoBytes([pubkey], fee, gasLimit, sequence), + accountNumber: Long.fromNumber(1), + chainId: "simd-testing", + }; + const signDocBytes = makeSignBytes(signDoc); + const signResponse = await wallet.signDirect(faucet.address, signDoc); const valid = await Secp256k1.verifySignature( - Secp256k1Signature.fromFixedLength(fromBase64(signature.signature)), - sha256(message), - defaultPubkey, + Secp256k1Signature.fromFixedLength(fromBase64(signResponse.signature.signature)), + sha256(signDocBytes), + pubkey.value, ); expect(valid).toEqual(true); }); diff --git a/packages/proto-signing/src/directsecp256k1wallet.ts b/packages/proto-signing/src/directsecp256k1wallet.ts index 4cca17dc..d6d3960f 100644 --- a/packages/proto-signing/src/directsecp256k1wallet.ts +++ b/packages/proto-signing/src/directsecp256k1wallet.ts @@ -13,9 +13,12 @@ import { encodeSecp256k1Signature, makeCosmoshubPath, rawSecp256k1PubkeyToAddress, - StdSignature, } from "@cosmjs/launchpad"; +import { cosmos } from "./codec"; +import { DirectSignResponse, OfflineDirectSigner } from "./signer"; +import { makeSignBytes } from "./signing"; + /** * Derivation information required to derive a keypair and an address from a mnemonic. */ @@ -25,7 +28,7 @@ interface Secp256k1Derivation { } /** A wallet for protobuf based signing using SIGN_MODE_DIRECT */ -export class DirectSecp256k1Wallet { +export class DirectSecp256k1Wallet implements OfflineDirectSigner { /** * Restores a wallet from the given BIP39 mnemonic. * @@ -113,13 +116,18 @@ export class DirectSecp256k1Wallet { ]; } - public async sign(address: string, message: Uint8Array): Promise { + public async signDirect(address: string, signDoc: cosmos.tx.v1beta1.ISignDoc): Promise { + const signBytes = makeSignBytes(signDoc); if (address !== this.address) { throw new Error(`Address ${address} not found in wallet`); } - const hashedMessage = sha256(message); + const hashedMessage = sha256(signBytes); const signature = await Secp256k1.createSignature(hashedMessage, this.privkey); const signatureBytes = new Uint8Array([...signature.r(32), ...signature.s(32)]); - return encodeSecp256k1Signature(this.pubkey, signatureBytes); + const stdSignature = encodeSecp256k1Signature(this.pubkey, signatureBytes); + return { + signed: signDoc, + signature: stdSignature, + }; } } diff --git a/packages/proto-signing/src/index.ts b/packages/proto-signing/src/index.ts index fc518bfd..b8112a32 100644 --- a/packages/proto-signing/src/index.ts +++ b/packages/proto-signing/src/index.ts @@ -3,4 +3,5 @@ export { cosmosField } from "./decorator"; export { Registry } from "./registry"; export { DirectSecp256k1Wallet } from "./directsecp256k1wallet"; export { decodePubkey, encodePubkey } from "./pubkey"; -export { makeAuthInfo, makeSignBytes } from "./signing"; +export { OfflineDirectSigner, OfflineSigner } from "./signer"; +export { makeAuthInfoBytes, makeSignBytes } from "./signing"; diff --git a/packages/proto-signing/src/signing.spec.ts b/packages/proto-signing/src/signing.spec.ts index 381dc00e..08b04fe9 100644 --- a/packages/proto-signing/src/signing.spec.ts +++ b/packages/proto-signing/src/signing.spec.ts @@ -1,56 +1,18 @@ /* eslint-disable @typescript-eslint/naming-convention */ import { fromBase64, fromHex, toHex } from "@cosmjs/encoding"; +import Long from "long"; import { cosmos, google } from "./codec"; import { DirectSecp256k1Wallet } from "./directsecp256k1wallet"; import { defaultRegistry } from "./msgs"; import { Registry, TxBodyValue } from "./registry"; -import { makeAuthInfo, makeSignBytes } from "./signing"; +import { makeAuthInfoBytes, makeSignBytes } from "./signing"; +import { faucet, testVectors } from "./testutils.spec"; const { Tx, TxRaw } = cosmos.tx.v1beta1; const { PubKey } = cosmos.crypto.secp256k1; const { Any } = google.protobuf; -const faucet = { - mnemonic: - "economy stock theory fatal elder harbor betray wasp final emotion task crumble siren bottom lizard educate guess current outdoor pair theory focus wife stone", - pubkey: { - type: "tendermint/PubKeySecp256k1", - value: "A08EGB7ro1ORuFhjOnZcSgwYlpe0DSFjVNUIkNNQxwKQ", - }, - address: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", -}; - -const testVectors = [ - { - sequence: 0, - signedTxBytes: - "0a93010a90010a1c2f636f736d6f732e62616e6b2e763162657461312e4d736753656e6412700a2d636f736d6f7331706b707472653766646b6c366766727a6c65736a6a766878686c63337234676d6d6b38727336122d636f736d6f7331717970717870713971637273737a673270767871367273307a716733797963356c7a763778751a100a0575636f736d12073132333435363712650a4e0a460a1f2f636f736d6f732e63727970746f2e736563703235366b312e5075624b657912230a21034f04181eeba35391b858633a765c4a0c189697b40d216354d50890d350c7029012040a02080112130a0d0a0575636f736d12043230303010c09a0c1a40c9dd20e07464d3a688ff4b710b1fbc027e495e797cfa0b4804da2ed117959227772de059808f765aa29b8f92edf30f4c2c5a438e30d3fe6897daa7141e3ce6f9", - signBytes: - "0a93010a90010a1c2f636f736d6f732e62616e6b2e763162657461312e4d736753656e6412700a2d636f736d6f7331706b707472653766646b6c366766727a6c65736a6a766878686c63337234676d6d6b38727336122d636f736d6f7331717970717870713971637273737a673270767871367273307a716733797963356c7a763778751a100a0575636f736d12073132333435363712650a4e0a460a1f2f636f736d6f732e63727970746f2e736563703235366b312e5075624b657912230a21034f04181eeba35391b858633a765c4a0c189697b40d216354d50890d350c7029012040a02080112130a0d0a0575636f736d12043230303010c09a0c1a0c73696d642d74657374696e672001", - signature: - "c9dd20e07464d3a688ff4b710b1fbc027e495e797cfa0b4804da2ed117959227772de059808f765aa29b8f92edf30f4c2c5a438e30d3fe6897daa7141e3ce6f9", - }, - { - sequence: 1, - signedTxBytes: - "0a93010a90010a1c2f636f736d6f732e62616e6b2e763162657461312e4d736753656e6412700a2d636f736d6f7331706b707472653766646b6c366766727a6c65736a6a766878686c63337234676d6d6b38727336122d636f736d6f7331717970717870713971637273737a673270767871367273307a716733797963356c7a763778751a100a0575636f736d12073132333435363712670a500a460a1f2f636f736d6f732e63727970746f2e736563703235366b312e5075624b657912230a21034f04181eeba35391b858633a765c4a0c189697b40d216354d50890d350c7029012040a020801180112130a0d0a0575636f736d12043230303010c09a0c1a40525adc7e61565a509c60497b798c549fbf217bb5cd31b24cc9b419d098cc95330c99ecc4bc72448f85c365a4e3f91299a3d40412fb3751bab82f1940a83a0a4c", - signBytes: - "0a93010a90010a1c2f636f736d6f732e62616e6b2e763162657461312e4d736753656e6412700a2d636f736d6f7331706b707472653766646b6c366766727a6c65736a6a766878686c63337234676d6d6b38727336122d636f736d6f7331717970717870713971637273737a673270767871367273307a716733797963356c7a763778751a100a0575636f736d12073132333435363712670a500a460a1f2f636f736d6f732e63727970746f2e736563703235366b312e5075624b657912230a21034f04181eeba35391b858633a765c4a0c189697b40d216354d50890d350c7029012040a020801180112130a0d0a0575636f736d12043230303010c09a0c1a0c73696d642d74657374696e672001", - signature: - "525adc7e61565a509c60497b798c549fbf217bb5cd31b24cc9b419d098cc95330c99ecc4bc72448f85c365a4e3f91299a3d40412fb3751bab82f1940a83a0a4c", - }, - { - sequence: 2, - signedTxBytes: - "0a93010a90010a1c2f636f736d6f732e62616e6b2e763162657461312e4d736753656e6412700a2d636f736d6f7331706b707472653766646b6c366766727a6c65736a6a766878686c63337234676d6d6b38727336122d636f736d6f7331717970717870713971637273737a673270767871367273307a716733797963356c7a763778751a100a0575636f736d12073132333435363712670a500a460a1f2f636f736d6f732e63727970746f2e736563703235366b312e5075624b657912230a21034f04181eeba35391b858633a765c4a0c189697b40d216354d50890d350c7029012040a020801180212130a0d0a0575636f736d12043230303010c09a0c1a40f3f2ca73806f2abbf6e0fe85f9b8af66f0e9f7f79051fdb8abe5bb8633b17da132e82d577b9d5f7a6dae57a144efc9ccc6eef15167b44b3b22a57240109762af", - signBytes: - "0a93010a90010a1c2f636f736d6f732e62616e6b2e763162657461312e4d736753656e6412700a2d636f736d6f7331706b707472653766646b6c366766727a6c65736a6a766878686c63337234676d6d6b38727336122d636f736d6f7331717970717870713971637273737a673270767871367273307a716733797963356c7a763778751a100a0575636f736d12073132333435363712670a500a460a1f2f636f736d6f732e63727970746f2e736563703235366b312e5075624b657912230a21034f04181eeba35391b858633a765c4a0c189697b40d216354d50890d350c7029012040a020801180212130a0d0a0575636f736d12043230303010c09a0c1a0c73696d642d74657374696e672001", - signature: - "f3f2ca73806f2abbf6e0fe85f9b8af66f0e9f7f79051fdb8abe5bb8633b17da132e82d577b9d5f7a6dae57a144efc9ccc6eef15167b44b3b22a57240109762af", - }, -]; - describe("signing", () => { const chainId = "simd-testing"; const toAddress = "cosmos1qypqxpq9qcrsszg2pvxq6rs0zqg3yyc5lzv7xu"; @@ -134,15 +96,21 @@ describe("signing", () => { await Promise.all( testVectors.map(async ({ sequence, signBytes, signedTxBytes }) => { - const authInfoBytes = makeAuthInfo([publicKeyAny], feeAmount, gasLimit, sequence); - const signDocBytes = makeSignBytes(txBodyBytes, authInfoBytes, chainId, accountNumber); + const authInfoBytes = makeAuthInfoBytes([publicKeyAny], feeAmount, gasLimit, sequence); + const signDoc = { + bodyBytes: txBodyBytes, + authInfoBytes: authInfoBytes, + chainId: chainId, + accountNumber: Long.fromNumber(accountNumber), + }; + const signDocBytes = makeSignBytes(signDoc); expect(toHex(signDocBytes)).toEqual(signBytes); - const signature = await wallet.sign(address, signDocBytes); + const signResponse = await wallet.signDirect(address, signDoc); const txRaw = TxRaw.create({ bodyBytes: txBodyBytes, authInfoBytes: authInfoBytes, - signatures: [fromBase64(signature.signature)], + signatures: [fromBase64(signResponse.signature.signature)], }); const txRawBytes = Uint8Array.from(TxRaw.encode(txRaw).finish()); const txBytesHex = toHex(txRawBytes); diff --git a/packages/proto-signing/src/signing.ts b/packages/proto-signing/src/signing.ts index aac3207a..6213360d 100644 --- a/packages/proto-signing/src/signing.ts +++ b/packages/proto-signing/src/signing.ts @@ -9,9 +9,9 @@ const { SignDoc, AuthInfo } = cosmos.tx.v1beta1; /** * Creates and serializes an AuthInfo document using SIGN_MODE_DIRECT. */ -export function makeAuthInfo( +export function makeAuthInfoBytes( pubkeys: readonly google.protobuf.IAny[], - feeAmount: cosmos.base.v1beta1.Coin[], + feeAmount: readonly cosmos.base.v1beta1.Coin[], gasLimit: number, sequence: number, ): Uint8Array { @@ -25,23 +25,23 @@ export function makeAuthInfo( sequence: sequence ? Long.fromNumber(sequence) : undefined, }), ), - fee: { amount: feeAmount, gasLimit: Long.fromNumber(gasLimit) }, + fee: { amount: [...feeAmount], gasLimit: Long.fromNumber(gasLimit) }, }; return Uint8Array.from(AuthInfo.encode(authInfo).finish()); } -export function makeSignBytes( - txBody: Uint8Array, - authInfo: Uint8Array, - chainId: string, - accountNumber: number, -): Uint8Array { +export function makeSignBytes({ + accountNumber, + authInfoBytes, + bodyBytes, + chainId, +}: cosmos.tx.v1beta1.ISignDoc): Uint8Array { const signDoc = SignDoc.create( omitDefaults({ - bodyBytes: txBody, - authInfoBytes: authInfo, - chainId: chainId, accountNumber: accountNumber, + authInfoBytes: authInfoBytes, + bodyBytes: bodyBytes, + chainId: chainId, }), ); return Uint8Array.from(SignDoc.encode(signDoc).finish()); diff --git a/packages/proto-signing/src/testutils.spec.ts b/packages/proto-signing/src/testutils.spec.ts index a00d8f8d..6c269e2e 100644 --- a/packages/proto-signing/src/testutils.spec.ts +++ b/packages/proto-signing/src/testutils.spec.ts @@ -1,2 +1,48 @@ /** @see https://rgxdb.com/r/1NUN74O6 */ export const base64Matcher = /^(?:[a-zA-Z0-9+/]{4})*(?:|(?:[a-zA-Z0-9+/]{3}=)|(?:[a-zA-Z0-9+/]{2}==)|(?:[a-zA-Z0-9+/]{1}===))$/; + +export const faucet = { + mnemonic: + "economy stock theory fatal elder harbor betray wasp final emotion task crumble siren bottom lizard educate guess current outdoor pair theory focus wife stone", + pubkey: { + type: "tendermint/PubKeySecp256k1", + value: "A08EGB7ro1ORuFhjOnZcSgwYlpe0DSFjVNUIkNNQxwKQ", + }, + address: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", +}; + +export const testVectors = [ + { + sequence: 0, + signedTxBytes: + "0a93010a90010a1c2f636f736d6f732e62616e6b2e763162657461312e4d736753656e6412700a2d636f736d6f7331706b707472653766646b6c366766727a6c65736a6a766878686c63337234676d6d6b38727336122d636f736d6f7331717970717870713971637273737a673270767871367273307a716733797963356c7a763778751a100a0575636f736d12073132333435363712650a4e0a460a1f2f636f736d6f732e63727970746f2e736563703235366b312e5075624b657912230a21034f04181eeba35391b858633a765c4a0c189697b40d216354d50890d350c7029012040a02080112130a0d0a0575636f736d12043230303010c09a0c1a40c9dd20e07464d3a688ff4b710b1fbc027e495e797cfa0b4804da2ed117959227772de059808f765aa29b8f92edf30f4c2c5a438e30d3fe6897daa7141e3ce6f9", + bodyBytes: + "0a90010a1c2f636f736d6f732e62616e6b2e763162657461312e4d736753656e6412700a2d636f736d6f7331706b707472653766646b6c366766727a6c65736a6a766878686c63337234676d6d6b38727336122d636f736d6f7331717970717870713971637273737a673270767871367273307a716733797963356c7a763778751a100a0575636f736d120731323334353637", + signBytes: + "0a93010a90010a1c2f636f736d6f732e62616e6b2e763162657461312e4d736753656e6412700a2d636f736d6f7331706b707472653766646b6c366766727a6c65736a6a766878686c63337234676d6d6b38727336122d636f736d6f7331717970717870713971637273737a673270767871367273307a716733797963356c7a763778751a100a0575636f736d12073132333435363712650a4e0a460a1f2f636f736d6f732e63727970746f2e736563703235366b312e5075624b657912230a21034f04181eeba35391b858633a765c4a0c189697b40d216354d50890d350c7029012040a02080112130a0d0a0575636f736d12043230303010c09a0c1a0c73696d642d74657374696e672001", + signature: + "c9dd20e07464d3a688ff4b710b1fbc027e495e797cfa0b4804da2ed117959227772de059808f765aa29b8f92edf30f4c2c5a438e30d3fe6897daa7141e3ce6f9", + }, + { + sequence: 1, + signedTxBytes: + "0a93010a90010a1c2f636f736d6f732e62616e6b2e763162657461312e4d736753656e6412700a2d636f736d6f7331706b707472653766646b6c366766727a6c65736a6a766878686c63337234676d6d6b38727336122d636f736d6f7331717970717870713971637273737a673270767871367273307a716733797963356c7a763778751a100a0575636f736d12073132333435363712670a500a460a1f2f636f736d6f732e63727970746f2e736563703235366b312e5075624b657912230a21034f04181eeba35391b858633a765c4a0c189697b40d216354d50890d350c7029012040a020801180112130a0d0a0575636f736d12043230303010c09a0c1a40525adc7e61565a509c60497b798c549fbf217bb5cd31b24cc9b419d098cc95330c99ecc4bc72448f85c365a4e3f91299a3d40412fb3751bab82f1940a83a0a4c", + signBytes: + "0a93010a90010a1c2f636f736d6f732e62616e6b2e763162657461312e4d736753656e6412700a2d636f736d6f7331706b707472653766646b6c366766727a6c65736a6a766878686c63337234676d6d6b38727336122d636f736d6f7331717970717870713971637273737a673270767871367273307a716733797963356c7a763778751a100a0575636f736d12073132333435363712670a500a460a1f2f636f736d6f732e63727970746f2e736563703235366b312e5075624b657912230a21034f04181eeba35391b858633a765c4a0c189697b40d216354d50890d350c7029012040a020801180112130a0d0a0575636f736d12043230303010c09a0c1a0c73696d642d74657374696e672001", + bodyBytes: + "0a90010a1c2f636f736d6f732e62616e6b2e763162657461312e4d736753656e6412700a2d636f736d6f7331706b707472653766646b6c366766727a6c65736a6a766878686c63337234676d6d6b38727336122d636f736d6f7331717970717870713971637273737a673270767871367273307a716733797963356c7a763778751a100a0575636f736d120731323334353637", + signature: + "525adc7e61565a509c60497b798c549fbf217bb5cd31b24cc9b419d098cc95330c99ecc4bc72448f85c365a4e3f91299a3d40412fb3751bab82f1940a83a0a4c", + }, + { + sequence: 2, + signedTxBytes: + "0a93010a90010a1c2f636f736d6f732e62616e6b2e763162657461312e4d736753656e6412700a2d636f736d6f7331706b707472653766646b6c366766727a6c65736a6a766878686c63337234676d6d6b38727336122d636f736d6f7331717970717870713971637273737a673270767871367273307a716733797963356c7a763778751a100a0575636f736d12073132333435363712670a500a460a1f2f636f736d6f732e63727970746f2e736563703235366b312e5075624b657912230a21034f04181eeba35391b858633a765c4a0c189697b40d216354d50890d350c7029012040a020801180212130a0d0a0575636f736d12043230303010c09a0c1a40f3f2ca73806f2abbf6e0fe85f9b8af66f0e9f7f79051fdb8abe5bb8633b17da132e82d577b9d5f7a6dae57a144efc9ccc6eef15167b44b3b22a57240109762af", + bodyBytes: + "0a90010a1c2f636f736d6f732e62616e6b2e763162657461312e4d736753656e6412700a2d636f736d6f7331706b707472653766646b6c366766727a6c65736a6a766878686c63337234676d6d6b38727336122d636f736d6f7331717970717870713971637273737a673270767871367273307a716733797963356c7a763778751a100a0575636f736d120731323334353637", + signBytes: + "0a93010a90010a1c2f636f736d6f732e62616e6b2e763162657461312e4d736753656e6412700a2d636f736d6f7331706b707472653766646b6c366766727a6c65736a6a766878686c63337234676d6d6b38727336122d636f736d6f7331717970717870713971637273737a673270767871367273307a716733797963356c7a763778751a100a0575636f736d12073132333435363712670a500a460a1f2f636f736d6f732e63727970746f2e736563703235366b312e5075624b657912230a21034f04181eeba35391b858633a765c4a0c189697b40d216354d50890d350c7029012040a020801180212130a0d0a0575636f736d12043230303010c09a0c1a0c73696d642d74657374696e672001", + signature: + "f3f2ca73806f2abbf6e0fe85f9b8af66f0e9f7f79051fdb8abe5bb8633b17da132e82d577b9d5f7a6dae57a144efc9ccc6eef15167b44b3b22a57240109762af", + }, +]; diff --git a/packages/proto-signing/types/directsecp256k1wallet.d.ts b/packages/proto-signing/types/directsecp256k1wallet.d.ts index 0adc32e3..cd9ea1ef 100644 --- a/packages/proto-signing/types/directsecp256k1wallet.d.ts +++ b/packages/proto-signing/types/directsecp256k1wallet.d.ts @@ -1,7 +1,9 @@ import { HdPath } from "@cosmjs/crypto"; -import { AccountData, StdSignature } from "@cosmjs/launchpad"; +import { AccountData } from "@cosmjs/launchpad"; +import { cosmos } from "./codec"; +import { DirectSignResponse, OfflineDirectSigner } from "./signer"; /** A wallet for protobuf based signing using SIGN_MODE_DIRECT */ -export declare class DirectSecp256k1Wallet { +export declare class DirectSecp256k1Wallet implements OfflineDirectSigner { /** * Restores a wallet from the given BIP39 mnemonic. * @@ -33,5 +35,5 @@ export declare class DirectSecp256k1Wallet { get mnemonic(): string; private get address(); getAccounts(): Promise; - sign(address: string, message: Uint8Array): Promise; + signDirect(address: string, signDoc: cosmos.tx.v1beta1.ISignDoc): Promise; } diff --git a/packages/proto-signing/types/index.d.ts b/packages/proto-signing/types/index.d.ts index fc518bfd..b8112a32 100644 --- a/packages/proto-signing/types/index.d.ts +++ b/packages/proto-signing/types/index.d.ts @@ -3,4 +3,5 @@ export { cosmosField } from "./decorator"; export { Registry } from "./registry"; export { DirectSecp256k1Wallet } from "./directsecp256k1wallet"; export { decodePubkey, encodePubkey } from "./pubkey"; -export { makeAuthInfo, makeSignBytes } from "./signing"; +export { OfflineDirectSigner, OfflineSigner } from "./signer"; +export { makeAuthInfoBytes, makeSignBytes } from "./signing"; diff --git a/packages/proto-signing/types/signing.d.ts b/packages/proto-signing/types/signing.d.ts index 6475907b..e7676b3b 100644 --- a/packages/proto-signing/types/signing.d.ts +++ b/packages/proto-signing/types/signing.d.ts @@ -2,15 +2,15 @@ import { cosmos, google } from "./codec"; /** * Creates and serializes an AuthInfo document using SIGN_MODE_DIRECT. */ -export declare function makeAuthInfo( +export declare function makeAuthInfoBytes( pubkeys: readonly google.protobuf.IAny[], - feeAmount: cosmos.base.v1beta1.Coin[], + feeAmount: readonly cosmos.base.v1beta1.Coin[], gasLimit: number, sequence: number, ): Uint8Array; -export declare function makeSignBytes( - txBody: Uint8Array, - authInfo: Uint8Array, - chainId: string, - accountNumber: number, -): Uint8Array; +export declare function makeSignBytes({ + accountNumber, + authInfoBytes, + bodyBytes, + chainId, +}: cosmos.tx.v1beta1.ISignDoc): Uint8Array; From e3069e35a125bede8006a939644e60e517e729b0 Mon Sep 17 00:00:00 2001 From: willclarktech Date: Wed, 21 Oct 2020 16:23:54 +0200 Subject: [PATCH 05/28] proto-signing: Add makeSignDoc helper function --- .../src/directsecp256k1wallet.spec.ts | 16 +++++++++------- packages/proto-signing/src/index.ts | 2 +- packages/proto-signing/src/signing.spec.ts | 9 ++------- packages/proto-signing/src/signing.ts | 14 ++++++++++++++ packages/proto-signing/types/index.d.ts | 2 +- packages/proto-signing/types/signing.d.ts | 6 ++++++ 6 files changed, 33 insertions(+), 16 deletions(-) diff --git a/packages/proto-signing/src/directsecp256k1wallet.spec.ts b/packages/proto-signing/src/directsecp256k1wallet.spec.ts index 732875f1..cd199b99 100644 --- a/packages/proto-signing/src/directsecp256k1wallet.spec.ts +++ b/packages/proto-signing/src/directsecp256k1wallet.spec.ts @@ -4,7 +4,7 @@ import { coins } from "@cosmjs/launchpad"; import Long from "long"; import { DirectSecp256k1Wallet } from "./directsecp256k1wallet"; -import { makeAuthInfoBytes, makeSignBytes } from "./signing"; +import { makeAuthInfoBytes, makeSignBytes, makeSignDoc } from "./signing"; import { faucet, testVectors } from "./testutils.spec"; describe("DirectSecp256k1Wallet", () => { @@ -68,12 +68,14 @@ describe("DirectSecp256k1Wallet", () => { }; const fee = coins(2000, "ucosm"); const gasLimit = 200000; - const signDoc = { - bodyBytes: fromHex(bodyBytes), - authInfoBytes: makeAuthInfoBytes([pubkey], fee, gasLimit, sequence), - accountNumber: Long.fromNumber(1), - chainId: "simd-testing", - }; + const chainId = "simd-testing"; + const accountNumber = 1; + const signDoc = makeSignDoc( + fromHex(bodyBytes), + makeAuthInfoBytes([pubkey], fee, gasLimit, sequence), + chainId, + accountNumber, + ); const signDocBytes = makeSignBytes(signDoc); const signResponse = await wallet.signDirect(faucet.address, signDoc); const valid = await Secp256k1.verifySignature( diff --git a/packages/proto-signing/src/index.ts b/packages/proto-signing/src/index.ts index b8112a32..ebc91f1a 100644 --- a/packages/proto-signing/src/index.ts +++ b/packages/proto-signing/src/index.ts @@ -4,4 +4,4 @@ export { Registry } from "./registry"; export { DirectSecp256k1Wallet } from "./directsecp256k1wallet"; export { decodePubkey, encodePubkey } from "./pubkey"; export { OfflineDirectSigner, OfflineSigner } from "./signer"; -export { makeAuthInfoBytes, makeSignBytes } from "./signing"; +export { makeAuthInfoBytes, makeSignBytes, makeSignDoc } from "./signing"; diff --git a/packages/proto-signing/src/signing.spec.ts b/packages/proto-signing/src/signing.spec.ts index 08b04fe9..26e0c284 100644 --- a/packages/proto-signing/src/signing.spec.ts +++ b/packages/proto-signing/src/signing.spec.ts @@ -6,7 +6,7 @@ import { cosmos, google } from "./codec"; import { DirectSecp256k1Wallet } from "./directsecp256k1wallet"; import { defaultRegistry } from "./msgs"; import { Registry, TxBodyValue } from "./registry"; -import { makeAuthInfoBytes, makeSignBytes } from "./signing"; +import { makeAuthInfoBytes, makeSignBytes, makeSignDoc } from "./signing"; import { faucet, testVectors } from "./testutils.spec"; const { Tx, TxRaw } = cosmos.tx.v1beta1; @@ -97,12 +97,7 @@ describe("signing", () => { await Promise.all( testVectors.map(async ({ sequence, signBytes, signedTxBytes }) => { const authInfoBytes = makeAuthInfoBytes([publicKeyAny], feeAmount, gasLimit, sequence); - const signDoc = { - bodyBytes: txBodyBytes, - authInfoBytes: authInfoBytes, - chainId: chainId, - accountNumber: Long.fromNumber(accountNumber), - }; + const signDoc = makeSignDoc(txBodyBytes, authInfoBytes, chainId, accountNumber); const signDocBytes = makeSignBytes(signDoc); expect(toHex(signDocBytes)).toEqual(signBytes); diff --git a/packages/proto-signing/src/signing.ts b/packages/proto-signing/src/signing.ts index 6213360d..ae152779 100644 --- a/packages/proto-signing/src/signing.ts +++ b/packages/proto-signing/src/signing.ts @@ -30,6 +30,20 @@ export function makeAuthInfoBytes( return Uint8Array.from(AuthInfo.encode(authInfo).finish()); } +export function makeSignDoc( + bodyBytes: Uint8Array, + authInfoBytes: Uint8Array, + chainId: string, + accountNumber: number, +): cosmos.tx.v1beta1.ISignDoc { + return { + bodyBytes: bodyBytes, + authInfoBytes: authInfoBytes, + chainId: chainId, + accountNumber: Long.fromNumber(accountNumber), + }; +} + export function makeSignBytes({ accountNumber, authInfoBytes, diff --git a/packages/proto-signing/types/index.d.ts b/packages/proto-signing/types/index.d.ts index b8112a32..ebc91f1a 100644 --- a/packages/proto-signing/types/index.d.ts +++ b/packages/proto-signing/types/index.d.ts @@ -4,4 +4,4 @@ export { Registry } from "./registry"; export { DirectSecp256k1Wallet } from "./directsecp256k1wallet"; export { decodePubkey, encodePubkey } from "./pubkey"; export { OfflineDirectSigner, OfflineSigner } from "./signer"; -export { makeAuthInfoBytes, makeSignBytes } from "./signing"; +export { makeAuthInfoBytes, makeSignBytes, makeSignDoc } from "./signing"; diff --git a/packages/proto-signing/types/signing.d.ts b/packages/proto-signing/types/signing.d.ts index e7676b3b..e3cc389d 100644 --- a/packages/proto-signing/types/signing.d.ts +++ b/packages/proto-signing/types/signing.d.ts @@ -8,6 +8,12 @@ export declare function makeAuthInfoBytes( gasLimit: number, sequence: number, ): Uint8Array; +export declare function makeSignDoc( + bodyBytes: Uint8Array, + authInfoBytes: Uint8Array, + chainId: string, + accountNumber: number, +): cosmos.tx.v1beta1.ISignDoc; export declare function makeSignBytes({ accountNumber, authInfoBytes, From 716f318bd9b110e2ce975a994bfa16a8b9ff7a88 Mon Sep 17 00:00:00 2001 From: willclarktech Date: Wed, 21 Oct 2020 16:27:54 +0200 Subject: [PATCH 06/28] stargate: Update for new OfflineSigner --- .../stargate/src/stargateclient.searchtx.spec.ts | 12 ++++++------ packages/stargate/src/stargateclient.spec.ts | 11 ++++++----- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/packages/stargate/src/stargateclient.searchtx.spec.ts b/packages/stargate/src/stargateclient.searchtx.spec.ts index db42cd89..ae771457 100644 --- a/packages/stargate/src/stargateclient.searchtx.spec.ts +++ b/packages/stargate/src/stargateclient.searchtx.spec.ts @@ -4,8 +4,8 @@ import { Coin, coins } from "@cosmjs/launchpad"; import { DirectSecp256k1Wallet, encodePubkey, - makeAuthInfo, - makeSignBytes, + makeAuthInfoBytes, + makeSignDoc, Registry, } from "@cosmjs/proto-signing"; import { assert, sleep } from "@cosmjs/utils"; @@ -70,15 +70,15 @@ async function sendTokens( }, ]; const gasLimit = 200000; - const authInfoBytes = makeAuthInfo([pubkey], feeAmount, gasLimit, sequence); + const authInfoBytes = makeAuthInfoBytes([pubkey], feeAmount, gasLimit, sequence); const chainId = await client.getChainId(); - const signDocBytes = makeSignBytes(txBodyBytes, authInfoBytes, chainId, accountNumber); - const signature = await wallet.sign(walletAddress, signDocBytes); + const signDoc = makeSignDoc(txBodyBytes, authInfoBytes, chainId, accountNumber); + const signResponse = await wallet.signDirect(walletAddress, signDoc); const txRaw = TxRaw.create({ bodyBytes: txBodyBytes, authInfoBytes: authInfoBytes, - signatures: [fromBase64(signature.signature)], + signatures: [fromBase64(signResponse.signature.signature)], }); const txRawBytes = Uint8Array.from(TxRaw.encode(txRaw).finish()); const broadcastResponse = await client.broadcastTx(txRawBytes); diff --git a/packages/stargate/src/stargateclient.spec.ts b/packages/stargate/src/stargateclient.spec.ts index b6863423..c09d95d1 100644 --- a/packages/stargate/src/stargateclient.spec.ts +++ b/packages/stargate/src/stargateclient.spec.ts @@ -3,8 +3,9 @@ import { fromBase64, toBase64 } from "@cosmjs/encoding"; import { DirectSecp256k1Wallet, encodePubkey, - makeAuthInfo, + makeAuthInfoBytes, makeSignBytes, + makeSignDoc, Registry, } from "@cosmjs/proto-signing"; import { assert, sleep } from "@cosmjs/utils"; @@ -292,15 +293,15 @@ describe("StargateClient", () => { }, ]; const gasLimit = 200000; - const authInfoBytes = makeAuthInfo([pubkey], feeAmount, gasLimit, sequence); + const authInfoBytes = makeAuthInfoBytes([pubkey], feeAmount, gasLimit, sequence); const chainId = await client.getChainId(); - const signDocBytes = makeSignBytes(txBodyBytes, authInfoBytes, chainId, accountNumber); - const signature = await wallet.sign(address, signDocBytes); + const signDoc = makeSignDoc(txBodyBytes, authInfoBytes, chainId, accountNumber); + const signResponse = await wallet.signDirect(address, signDoc); const txRaw = TxRaw.create({ bodyBytes: txBodyBytes, authInfoBytes: authInfoBytes, - signatures: [fromBase64(signature.signature)], + signatures: [fromBase64(signResponse.signature.signature)], }); const txRawBytes = Uint8Array.from(TxRaw.encode(txRaw).finish()); const txResult = await client.broadcastTx(txRawBytes); From e9451c92754f1e7de812b754194a0d7e7008bbf2 Mon Sep 17 00:00:00 2001 From: willclarktech Date: Wed, 21 Oct 2020 16:38:01 +0200 Subject: [PATCH 07/28] proto-signing: Add isOfflineDirectSigner helper --- packages/proto-signing/src/index.ts | 2 +- packages/proto-signing/src/signer.ts | 4 ++++ packages/proto-signing/types/index.d.ts | 2 +- packages/proto-signing/types/signer.d.ts | 1 + 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/proto-signing/src/index.ts b/packages/proto-signing/src/index.ts index ebc91f1a..2585de8f 100644 --- a/packages/proto-signing/src/index.ts +++ b/packages/proto-signing/src/index.ts @@ -3,5 +3,5 @@ export { cosmosField } from "./decorator"; export { Registry } from "./registry"; export { DirectSecp256k1Wallet } from "./directsecp256k1wallet"; export { decodePubkey, encodePubkey } from "./pubkey"; -export { OfflineDirectSigner, OfflineSigner } from "./signer"; +export { isOfflineDirectSigner, OfflineDirectSigner, OfflineSigner } from "./signer"; export { makeAuthInfoBytes, makeSignBytes, makeSignDoc } from "./signing"; diff --git a/packages/proto-signing/src/signer.ts b/packages/proto-signing/src/signer.ts index a5aca75b..424eeae8 100644 --- a/packages/proto-signing/src/signer.ts +++ b/packages/proto-signing/src/signer.ts @@ -20,3 +20,7 @@ export interface OfflineDirectSigner { } export type OfflineSigner = OfflineAminoSigner | OfflineDirectSigner; + +export function isOfflineDirectSigner(signer: OfflineSigner): signer is OfflineDirectSigner { + return (signer as any).signDirect !== undefined; +} diff --git a/packages/proto-signing/types/index.d.ts b/packages/proto-signing/types/index.d.ts index ebc91f1a..2585de8f 100644 --- a/packages/proto-signing/types/index.d.ts +++ b/packages/proto-signing/types/index.d.ts @@ -3,5 +3,5 @@ export { cosmosField } from "./decorator"; export { Registry } from "./registry"; export { DirectSecp256k1Wallet } from "./directsecp256k1wallet"; export { decodePubkey, encodePubkey } from "./pubkey"; -export { OfflineDirectSigner, OfflineSigner } from "./signer"; +export { isOfflineDirectSigner, OfflineDirectSigner, OfflineSigner } from "./signer"; export { makeAuthInfoBytes, makeSignBytes, makeSignDoc } from "./signing"; diff --git a/packages/proto-signing/types/signer.d.ts b/packages/proto-signing/types/signer.d.ts index dc2d9e98..2037b89a 100644 --- a/packages/proto-signing/types/signer.d.ts +++ b/packages/proto-signing/types/signer.d.ts @@ -16,3 +16,4 @@ export interface OfflineDirectSigner { ) => Promise; } export declare type OfflineSigner = OfflineAminoSigner | OfflineDirectSigner; +export declare function isOfflineDirectSigner(signer: OfflineSigner): signer is OfflineDirectSigner; From 2037b524f67ac594d1d2e39a36dfcd00581fbc73 Mon Sep 17 00:00:00 2001 From: willclarktech Date: Tue, 20 Oct 2020 15:47:35 +0200 Subject: [PATCH 08/28] stargate: Update predefine-proto script for staking --- packages/stargate/scripts/predefine-proto.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/stargate/scripts/predefine-proto.sh b/packages/stargate/scripts/predefine-proto.sh index 313d3033..72081199 100755 --- a/packages/stargate/scripts/predefine-proto.sh +++ b/packages/stargate/scripts/predefine-proto.sh @@ -27,6 +27,8 @@ yarn pbjs \ "$COSMOS_PROTO_DIR/base/v1beta1/coin.proto" \ "$COSMOS_PROTO_DIR/crypto/multisig/v1beta1/multisig.proto" \ "$COSMOS_PROTO_DIR/crypto/secp256k1/keys.proto" \ + "$COSMOS_PROTO_DIR/staking/v1beta1/staking.proto" \ + "$COSMOS_PROTO_DIR/staking/v1beta1/tx.proto" \ "$COSMOS_PROTO_DIR/tx/signing/v1beta1/signing.proto" \ "$COSMOS_PROTO_DIR/tx/v1beta1/tx.proto" \ "$IBC_PROTO_DIR/core/channel/v1/channel.proto" \ @@ -35,7 +37,12 @@ yarn pbjs \ "$IBC_PROTO_DIR/core/commitment/v1/commitment.proto" \ "$IBC_PROTO_DIR/core/connection/v1/connection.proto" \ "$IBC_PROTO_DIR/core/connection/v1/query.proto" \ - "$TENDERMINT_PROTO_DIR/crypto/proof.proto" + "$TENDERMINT_PROTO_DIR/crypto/keys.proto" \ + "$TENDERMINT_PROTO_DIR/crypto/proof.proto" \ + "$TENDERMINT_PROTO_DIR/libs/bits/types.proto" \ + "$TENDERMINT_PROTO_DIR/types/types.proto" \ + "$TENDERMINT_PROTO_DIR/types/validator.proto" \ + "$TENDERMINT_PROTO_DIR/version/types.proto" # Work around https://github.com/protobufjs/protobuf.js/issues/1477 # shellcheck disable=SC2016 From 1a582a738c574cbcaef9bd435bd31796daedcffe Mon Sep 17 00:00:00 2001 From: willclarktech Date: Tue, 20 Oct 2020 15:47:46 +0200 Subject: [PATCH 09/28] stargate: Update codec --- .../src/codec/generated/codecimpl.d.ts | 2877 +++++++++++++++++ .../stargate/src/codec/generated/codecimpl.js | 2397 ++++++++++++++ .../types/codec/generated/codecimpl.d.ts | 2877 +++++++++++++++++ 3 files changed, 8151 insertions(+) diff --git a/packages/stargate/src/codec/generated/codecimpl.d.ts b/packages/stargate/src/codec/generated/codecimpl.d.ts index e348516f..346edf38 100644 --- a/packages/stargate/src/codec/generated/codecimpl.d.ts +++ b/packages/stargate/src/codec/generated/codecimpl.d.ts @@ -1695,6 +1695,1564 @@ export namespace cosmos { } } + /** Namespace staking. */ + namespace staking { + /** Namespace v1beta1. */ + namespace v1beta1 { + /** Properties of a HistoricalInfo. */ + interface IHistoricalInfo { + /** HistoricalInfo header */ + header?: tendermint.types.IHeader | null; + + /** HistoricalInfo valset */ + valset?: cosmos.staking.v1beta1.IValidator[] | null; + } + + /** Represents a HistoricalInfo. */ + class HistoricalInfo implements IHistoricalInfo { + /** + * Constructs a new HistoricalInfo. + * @param [p] Properties to set + */ + constructor(p?: cosmos.staking.v1beta1.IHistoricalInfo); + + /** HistoricalInfo header. */ + public header?: tendermint.types.IHeader | null; + + /** HistoricalInfo valset. */ + public valset: cosmos.staking.v1beta1.IValidator[]; + + /** + * Creates a new HistoricalInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns HistoricalInfo instance + */ + public static create( + properties?: cosmos.staking.v1beta1.IHistoricalInfo, + ): cosmos.staking.v1beta1.HistoricalInfo; + + /** + * Encodes the specified HistoricalInfo message. Does not implicitly {@link cosmos.staking.v1beta1.HistoricalInfo.verify|verify} messages. + * @param m HistoricalInfo message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode( + m: cosmos.staking.v1beta1.IHistoricalInfo, + w?: $protobuf.Writer, + ): $protobuf.Writer; + + /** + * Decodes a HistoricalInfo message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns HistoricalInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode( + r: $protobuf.Reader | Uint8Array, + l?: number, + ): cosmos.staking.v1beta1.HistoricalInfo; + } + + /** Properties of a CommissionRates. */ + interface ICommissionRates { + /** CommissionRates rate */ + rate?: string | null; + + /** CommissionRates maxRate */ + maxRate?: string | null; + + /** CommissionRates maxChangeRate */ + maxChangeRate?: string | null; + } + + /** Represents a CommissionRates. */ + class CommissionRates implements ICommissionRates { + /** + * Constructs a new CommissionRates. + * @param [p] Properties to set + */ + constructor(p?: cosmos.staking.v1beta1.ICommissionRates); + + /** CommissionRates rate. */ + public rate: string; + + /** CommissionRates maxRate. */ + public maxRate: string; + + /** CommissionRates maxChangeRate. */ + public maxChangeRate: string; + + /** + * Creates a new CommissionRates instance using the specified properties. + * @param [properties] Properties to set + * @returns CommissionRates instance + */ + public static create( + properties?: cosmos.staking.v1beta1.ICommissionRates, + ): cosmos.staking.v1beta1.CommissionRates; + + /** + * Encodes the specified CommissionRates message. Does not implicitly {@link cosmos.staking.v1beta1.CommissionRates.verify|verify} messages. + * @param m CommissionRates message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode( + m: cosmos.staking.v1beta1.ICommissionRates, + w?: $protobuf.Writer, + ): $protobuf.Writer; + + /** + * Decodes a CommissionRates message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns CommissionRates + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode( + r: $protobuf.Reader | Uint8Array, + l?: number, + ): cosmos.staking.v1beta1.CommissionRates; + } + + /** Properties of a Commission. */ + interface ICommission { + /** Commission commissionRates */ + commissionRates?: cosmos.staking.v1beta1.ICommissionRates | null; + + /** Commission updateTime */ + updateTime?: google.protobuf.ITimestamp | null; + } + + /** Represents a Commission. */ + class Commission implements ICommission { + /** + * Constructs a new Commission. + * @param [p] Properties to set + */ + constructor(p?: cosmos.staking.v1beta1.ICommission); + + /** Commission commissionRates. */ + public commissionRates?: cosmos.staking.v1beta1.ICommissionRates | null; + + /** Commission updateTime. */ + public updateTime?: google.protobuf.ITimestamp | null; + + /** + * Creates a new Commission instance using the specified properties. + * @param [properties] Properties to set + * @returns Commission instance + */ + public static create( + properties?: cosmos.staking.v1beta1.ICommission, + ): cosmos.staking.v1beta1.Commission; + + /** + * Encodes the specified Commission message. Does not implicitly {@link cosmos.staking.v1beta1.Commission.verify|verify} messages. + * @param m Commission message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: cosmos.staking.v1beta1.ICommission, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Commission message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns Commission + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): cosmos.staking.v1beta1.Commission; + } + + /** Properties of a Description. */ + interface IDescription { + /** Description moniker */ + moniker?: string | null; + + /** Description identity */ + identity?: string | null; + + /** Description website */ + website?: string | null; + + /** Description securityContact */ + securityContact?: string | null; + + /** Description details */ + details?: string | null; + } + + /** Represents a Description. */ + class Description implements IDescription { + /** + * Constructs a new Description. + * @param [p] Properties to set + */ + constructor(p?: cosmos.staking.v1beta1.IDescription); + + /** Description moniker. */ + public moniker: string; + + /** Description identity. */ + public identity: string; + + /** Description website. */ + public website: string; + + /** Description securityContact. */ + public securityContact: string; + + /** Description details. */ + public details: string; + + /** + * Creates a new Description instance using the specified properties. + * @param [properties] Properties to set + * @returns Description instance + */ + public static create( + properties?: cosmos.staking.v1beta1.IDescription, + ): cosmos.staking.v1beta1.Description; + + /** + * Encodes the specified Description message. Does not implicitly {@link cosmos.staking.v1beta1.Description.verify|verify} messages. + * @param m Description message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: cosmos.staking.v1beta1.IDescription, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Description message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns Description + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode( + r: $protobuf.Reader | Uint8Array, + l?: number, + ): cosmos.staking.v1beta1.Description; + } + + /** Properties of a Validator. */ + interface IValidator { + /** Validator operatorAddress */ + operatorAddress?: string | null; + + /** Validator consensusPubkey */ + consensusPubkey?: string | null; + + /** Validator jailed */ + jailed?: boolean | null; + + /** Validator status */ + status?: number | null; + + /** Validator tokens */ + tokens?: string | null; + + /** Validator delegatorShares */ + delegatorShares?: string | null; + + /** Validator description */ + description?: cosmos.staking.v1beta1.IDescription | null; + + /** Validator unbondingHeight */ + unbondingHeight?: Long | null; + + /** Validator unbondingTime */ + unbondingTime?: google.protobuf.ITimestamp | null; + + /** Validator commission */ + commission?: cosmos.staking.v1beta1.ICommission | null; + + /** Validator minSelfDelegation */ + minSelfDelegation?: string | null; + } + + /** Represents a Validator. */ + class Validator implements IValidator { + /** + * Constructs a new Validator. + * @param [p] Properties to set + */ + constructor(p?: cosmos.staking.v1beta1.IValidator); + + /** Validator operatorAddress. */ + public operatorAddress: string; + + /** Validator consensusPubkey. */ + public consensusPubkey: string; + + /** Validator jailed. */ + public jailed: boolean; + + /** Validator status. */ + public status: number; + + /** Validator tokens. */ + public tokens: string; + + /** Validator delegatorShares. */ + public delegatorShares: string; + + /** Validator description. */ + public description?: cosmos.staking.v1beta1.IDescription | null; + + /** Validator unbondingHeight. */ + public unbondingHeight: Long; + + /** Validator unbondingTime. */ + public unbondingTime?: google.protobuf.ITimestamp | null; + + /** Validator commission. */ + public commission?: cosmos.staking.v1beta1.ICommission | null; + + /** Validator minSelfDelegation. */ + public minSelfDelegation: string; + + /** + * Creates a new Validator instance using the specified properties. + * @param [properties] Properties to set + * @returns Validator instance + */ + public static create( + properties?: cosmos.staking.v1beta1.IValidator, + ): cosmos.staking.v1beta1.Validator; + + /** + * Encodes the specified Validator message. Does not implicitly {@link cosmos.staking.v1beta1.Validator.verify|verify} messages. + * @param m Validator message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: cosmos.staking.v1beta1.IValidator, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Validator message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns Validator + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): cosmos.staking.v1beta1.Validator; + } + + /** Properties of a ValAddresses. */ + interface IValAddresses { + /** ValAddresses addresses */ + addresses?: string[] | null; + } + + /** Represents a ValAddresses. */ + class ValAddresses implements IValAddresses { + /** + * Constructs a new ValAddresses. + * @param [p] Properties to set + */ + constructor(p?: cosmos.staking.v1beta1.IValAddresses); + + /** ValAddresses addresses. */ + public addresses: string[]; + + /** + * Creates a new ValAddresses instance using the specified properties. + * @param [properties] Properties to set + * @returns ValAddresses instance + */ + public static create( + properties?: cosmos.staking.v1beta1.IValAddresses, + ): cosmos.staking.v1beta1.ValAddresses; + + /** + * Encodes the specified ValAddresses message. Does not implicitly {@link cosmos.staking.v1beta1.ValAddresses.verify|verify} messages. + * @param m ValAddresses message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: cosmos.staking.v1beta1.IValAddresses, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ValAddresses message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns ValAddresses + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode( + r: $protobuf.Reader | Uint8Array, + l?: number, + ): cosmos.staking.v1beta1.ValAddresses; + } + + /** Properties of a DVPair. */ + interface IDVPair { + /** DVPair delegatorAddress */ + delegatorAddress?: string | null; + + /** DVPair validatorAddress */ + validatorAddress?: string | null; + } + + /** Represents a DVPair. */ + class DVPair implements IDVPair { + /** + * Constructs a new DVPair. + * @param [p] Properties to set + */ + constructor(p?: cosmos.staking.v1beta1.IDVPair); + + /** DVPair delegatorAddress. */ + public delegatorAddress: string; + + /** DVPair validatorAddress. */ + public validatorAddress: string; + + /** + * Creates a new DVPair instance using the specified properties. + * @param [properties] Properties to set + * @returns DVPair instance + */ + public static create(properties?: cosmos.staking.v1beta1.IDVPair): cosmos.staking.v1beta1.DVPair; + + /** + * Encodes the specified DVPair message. Does not implicitly {@link cosmos.staking.v1beta1.DVPair.verify|verify} messages. + * @param m DVPair message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: cosmos.staking.v1beta1.IDVPair, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DVPair message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns DVPair + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): cosmos.staking.v1beta1.DVPair; + } + + /** Properties of a DVPairs. */ + interface IDVPairs { + /** DVPairs pairs */ + pairs?: cosmos.staking.v1beta1.IDVPair[] | null; + } + + /** Represents a DVPairs. */ + class DVPairs implements IDVPairs { + /** + * Constructs a new DVPairs. + * @param [p] Properties to set + */ + constructor(p?: cosmos.staking.v1beta1.IDVPairs); + + /** DVPairs pairs. */ + public pairs: cosmos.staking.v1beta1.IDVPair[]; + + /** + * Creates a new DVPairs instance using the specified properties. + * @param [properties] Properties to set + * @returns DVPairs instance + */ + public static create(properties?: cosmos.staking.v1beta1.IDVPairs): cosmos.staking.v1beta1.DVPairs; + + /** + * Encodes the specified DVPairs message. Does not implicitly {@link cosmos.staking.v1beta1.DVPairs.verify|verify} messages. + * @param m DVPairs message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: cosmos.staking.v1beta1.IDVPairs, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DVPairs message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns DVPairs + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): cosmos.staking.v1beta1.DVPairs; + } + + /** Properties of a DVVTriplet. */ + interface IDVVTriplet { + /** DVVTriplet delegatorAddress */ + delegatorAddress?: string | null; + + /** DVVTriplet validatorSrcAddress */ + validatorSrcAddress?: string | null; + + /** DVVTriplet validatorDstAddress */ + validatorDstAddress?: string | null; + } + + /** Represents a DVVTriplet. */ + class DVVTriplet implements IDVVTriplet { + /** + * Constructs a new DVVTriplet. + * @param [p] Properties to set + */ + constructor(p?: cosmos.staking.v1beta1.IDVVTriplet); + + /** DVVTriplet delegatorAddress. */ + public delegatorAddress: string; + + /** DVVTriplet validatorSrcAddress. */ + public validatorSrcAddress: string; + + /** DVVTriplet validatorDstAddress. */ + public validatorDstAddress: string; + + /** + * Creates a new DVVTriplet instance using the specified properties. + * @param [properties] Properties to set + * @returns DVVTriplet instance + */ + public static create( + properties?: cosmos.staking.v1beta1.IDVVTriplet, + ): cosmos.staking.v1beta1.DVVTriplet; + + /** + * Encodes the specified DVVTriplet message. Does not implicitly {@link cosmos.staking.v1beta1.DVVTriplet.verify|verify} messages. + * @param m DVVTriplet message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: cosmos.staking.v1beta1.IDVVTriplet, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DVVTriplet message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns DVVTriplet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): cosmos.staking.v1beta1.DVVTriplet; + } + + /** Properties of a DVVTriplets. */ + interface IDVVTriplets { + /** DVVTriplets triplets */ + triplets?: cosmos.staking.v1beta1.IDVVTriplet[] | null; + } + + /** Represents a DVVTriplets. */ + class DVVTriplets implements IDVVTriplets { + /** + * Constructs a new DVVTriplets. + * @param [p] Properties to set + */ + constructor(p?: cosmos.staking.v1beta1.IDVVTriplets); + + /** DVVTriplets triplets. */ + public triplets: cosmos.staking.v1beta1.IDVVTriplet[]; + + /** + * Creates a new DVVTriplets instance using the specified properties. + * @param [properties] Properties to set + * @returns DVVTriplets instance + */ + public static create( + properties?: cosmos.staking.v1beta1.IDVVTriplets, + ): cosmos.staking.v1beta1.DVVTriplets; + + /** + * Encodes the specified DVVTriplets message. Does not implicitly {@link cosmos.staking.v1beta1.DVVTriplets.verify|verify} messages. + * @param m DVVTriplets message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: cosmos.staking.v1beta1.IDVVTriplets, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DVVTriplets message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns DVVTriplets + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode( + r: $protobuf.Reader | Uint8Array, + l?: number, + ): cosmos.staking.v1beta1.DVVTriplets; + } + + /** Properties of a Delegation. */ + interface IDelegation { + /** Delegation delegatorAddress */ + delegatorAddress?: string | null; + + /** Delegation validatorAddress */ + validatorAddress?: string | null; + + /** Delegation shares */ + shares?: string | null; + } + + /** Represents a Delegation. */ + class Delegation implements IDelegation { + /** + * Constructs a new Delegation. + * @param [p] Properties to set + */ + constructor(p?: cosmos.staking.v1beta1.IDelegation); + + /** Delegation delegatorAddress. */ + public delegatorAddress: string; + + /** Delegation validatorAddress. */ + public validatorAddress: string; + + /** Delegation shares. */ + public shares: string; + + /** + * Creates a new Delegation instance using the specified properties. + * @param [properties] Properties to set + * @returns Delegation instance + */ + public static create( + properties?: cosmos.staking.v1beta1.IDelegation, + ): cosmos.staking.v1beta1.Delegation; + + /** + * Encodes the specified Delegation message. Does not implicitly {@link cosmos.staking.v1beta1.Delegation.verify|verify} messages. + * @param m Delegation message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: cosmos.staking.v1beta1.IDelegation, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Delegation message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns Delegation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): cosmos.staking.v1beta1.Delegation; + } + + /** Properties of an UnbondingDelegation. */ + interface IUnbondingDelegation { + /** UnbondingDelegation delegatorAddress */ + delegatorAddress?: string | null; + + /** UnbondingDelegation validatorAddress */ + validatorAddress?: string | null; + + /** UnbondingDelegation entries */ + entries?: cosmos.staking.v1beta1.IUnbondingDelegationEntry[] | null; + } + + /** Represents an UnbondingDelegation. */ + class UnbondingDelegation implements IUnbondingDelegation { + /** + * Constructs a new UnbondingDelegation. + * @param [p] Properties to set + */ + constructor(p?: cosmos.staking.v1beta1.IUnbondingDelegation); + + /** UnbondingDelegation delegatorAddress. */ + public delegatorAddress: string; + + /** UnbondingDelegation validatorAddress. */ + public validatorAddress: string; + + /** UnbondingDelegation entries. */ + public entries: cosmos.staking.v1beta1.IUnbondingDelegationEntry[]; + + /** + * Creates a new UnbondingDelegation instance using the specified properties. + * @param [properties] Properties to set + * @returns UnbondingDelegation instance + */ + public static create( + properties?: cosmos.staking.v1beta1.IUnbondingDelegation, + ): cosmos.staking.v1beta1.UnbondingDelegation; + + /** + * Encodes the specified UnbondingDelegation message. Does not implicitly {@link cosmos.staking.v1beta1.UnbondingDelegation.verify|verify} messages. + * @param m UnbondingDelegation message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode( + m: cosmos.staking.v1beta1.IUnbondingDelegation, + w?: $protobuf.Writer, + ): $protobuf.Writer; + + /** + * Decodes an UnbondingDelegation message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns UnbondingDelegation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode( + r: $protobuf.Reader | Uint8Array, + l?: number, + ): cosmos.staking.v1beta1.UnbondingDelegation; + } + + /** Properties of an UnbondingDelegationEntry. */ + interface IUnbondingDelegationEntry { + /** UnbondingDelegationEntry creationHeight */ + creationHeight?: Long | null; + + /** UnbondingDelegationEntry completionTime */ + completionTime?: google.protobuf.ITimestamp | null; + + /** UnbondingDelegationEntry initialBalance */ + initialBalance?: string | null; + + /** UnbondingDelegationEntry balance */ + balance?: string | null; + } + + /** Represents an UnbondingDelegationEntry. */ + class UnbondingDelegationEntry implements IUnbondingDelegationEntry { + /** + * Constructs a new UnbondingDelegationEntry. + * @param [p] Properties to set + */ + constructor(p?: cosmos.staking.v1beta1.IUnbondingDelegationEntry); + + /** UnbondingDelegationEntry creationHeight. */ + public creationHeight: Long; + + /** UnbondingDelegationEntry completionTime. */ + public completionTime?: google.protobuf.ITimestamp | null; + + /** UnbondingDelegationEntry initialBalance. */ + public initialBalance: string; + + /** UnbondingDelegationEntry balance. */ + public balance: string; + + /** + * Creates a new UnbondingDelegationEntry instance using the specified properties. + * @param [properties] Properties to set + * @returns UnbondingDelegationEntry instance + */ + public static create( + properties?: cosmos.staking.v1beta1.IUnbondingDelegationEntry, + ): cosmos.staking.v1beta1.UnbondingDelegationEntry; + + /** + * Encodes the specified UnbondingDelegationEntry message. Does not implicitly {@link cosmos.staking.v1beta1.UnbondingDelegationEntry.verify|verify} messages. + * @param m UnbondingDelegationEntry message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode( + m: cosmos.staking.v1beta1.IUnbondingDelegationEntry, + w?: $protobuf.Writer, + ): $protobuf.Writer; + + /** + * Decodes an UnbondingDelegationEntry message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns UnbondingDelegationEntry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode( + r: $protobuf.Reader | Uint8Array, + l?: number, + ): cosmos.staking.v1beta1.UnbondingDelegationEntry; + } + + /** Properties of a RedelegationEntry. */ + interface IRedelegationEntry { + /** RedelegationEntry creationHeight */ + creationHeight?: Long | null; + + /** RedelegationEntry completionTime */ + completionTime?: google.protobuf.ITimestamp | null; + + /** RedelegationEntry initialBalance */ + initialBalance?: string | null; + + /** RedelegationEntry sharesDst */ + sharesDst?: string | null; + } + + /** Represents a RedelegationEntry. */ + class RedelegationEntry implements IRedelegationEntry { + /** + * Constructs a new RedelegationEntry. + * @param [p] Properties to set + */ + constructor(p?: cosmos.staking.v1beta1.IRedelegationEntry); + + /** RedelegationEntry creationHeight. */ + public creationHeight: Long; + + /** RedelegationEntry completionTime. */ + public completionTime?: google.protobuf.ITimestamp | null; + + /** RedelegationEntry initialBalance. */ + public initialBalance: string; + + /** RedelegationEntry sharesDst. */ + public sharesDst: string; + + /** + * Creates a new RedelegationEntry instance using the specified properties. + * @param [properties] Properties to set + * @returns RedelegationEntry instance + */ + public static create( + properties?: cosmos.staking.v1beta1.IRedelegationEntry, + ): cosmos.staking.v1beta1.RedelegationEntry; + + /** + * Encodes the specified RedelegationEntry message. Does not implicitly {@link cosmos.staking.v1beta1.RedelegationEntry.verify|verify} messages. + * @param m RedelegationEntry message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode( + m: cosmos.staking.v1beta1.IRedelegationEntry, + w?: $protobuf.Writer, + ): $protobuf.Writer; + + /** + * Decodes a RedelegationEntry message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns RedelegationEntry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode( + r: $protobuf.Reader | Uint8Array, + l?: number, + ): cosmos.staking.v1beta1.RedelegationEntry; + } + + /** Properties of a Redelegation. */ + interface IRedelegation { + /** Redelegation delegatorAddress */ + delegatorAddress?: string | null; + + /** Redelegation validatorSrcAddress */ + validatorSrcAddress?: string | null; + + /** Redelegation validatorDstAddress */ + validatorDstAddress?: string | null; + + /** Redelegation entries */ + entries?: cosmos.staking.v1beta1.IRedelegationEntry[] | null; + } + + /** Represents a Redelegation. */ + class Redelegation implements IRedelegation { + /** + * Constructs a new Redelegation. + * @param [p] Properties to set + */ + constructor(p?: cosmos.staking.v1beta1.IRedelegation); + + /** Redelegation delegatorAddress. */ + public delegatorAddress: string; + + /** Redelegation validatorSrcAddress. */ + public validatorSrcAddress: string; + + /** Redelegation validatorDstAddress. */ + public validatorDstAddress: string; + + /** Redelegation entries. */ + public entries: cosmos.staking.v1beta1.IRedelegationEntry[]; + + /** + * Creates a new Redelegation instance using the specified properties. + * @param [properties] Properties to set + * @returns Redelegation instance + */ + public static create( + properties?: cosmos.staking.v1beta1.IRedelegation, + ): cosmos.staking.v1beta1.Redelegation; + + /** + * Encodes the specified Redelegation message. Does not implicitly {@link cosmos.staking.v1beta1.Redelegation.verify|verify} messages. + * @param m Redelegation message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: cosmos.staking.v1beta1.IRedelegation, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Redelegation message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns Redelegation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode( + r: $protobuf.Reader | Uint8Array, + l?: number, + ): cosmos.staking.v1beta1.Redelegation; + } + + /** Properties of a Params. */ + interface IParams { + /** Params unbondingTime */ + unbondingTime?: google.protobuf.IDuration | null; + + /** Params maxValidators */ + maxValidators?: number | null; + + /** Params maxEntries */ + maxEntries?: number | null; + + /** Params historicalEntries */ + historicalEntries?: number | null; + + /** Params bondDenom */ + bondDenom?: string | null; + } + + /** Represents a Params. */ + class Params implements IParams { + /** + * Constructs a new Params. + * @param [p] Properties to set + */ + constructor(p?: cosmos.staking.v1beta1.IParams); + + /** Params unbondingTime. */ + public unbondingTime?: google.protobuf.IDuration | null; + + /** Params maxValidators. */ + public maxValidators: number; + + /** Params maxEntries. */ + public maxEntries: number; + + /** Params historicalEntries. */ + public historicalEntries: number; + + /** Params bondDenom. */ + public bondDenom: string; + + /** + * Creates a new Params instance using the specified properties. + * @param [properties] Properties to set + * @returns Params instance + */ + public static create(properties?: cosmos.staking.v1beta1.IParams): cosmos.staking.v1beta1.Params; + + /** + * Encodes the specified Params message. Does not implicitly {@link cosmos.staking.v1beta1.Params.verify|verify} messages. + * @param m Params message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: cosmos.staking.v1beta1.IParams, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Params message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns Params + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): cosmos.staking.v1beta1.Params; + } + + /** Properties of a DelegationResponse. */ + interface IDelegationResponse { + /** DelegationResponse delegation */ + delegation?: cosmos.staking.v1beta1.IDelegation | null; + + /** DelegationResponse balance */ + balance?: cosmos.base.v1beta1.ICoin | null; + } + + /** Represents a DelegationResponse. */ + class DelegationResponse implements IDelegationResponse { + /** + * Constructs a new DelegationResponse. + * @param [p] Properties to set + */ + constructor(p?: cosmos.staking.v1beta1.IDelegationResponse); + + /** DelegationResponse delegation. */ + public delegation?: cosmos.staking.v1beta1.IDelegation | null; + + /** DelegationResponse balance. */ + public balance?: cosmos.base.v1beta1.ICoin | null; + + /** + * Creates a new DelegationResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns DelegationResponse instance + */ + public static create( + properties?: cosmos.staking.v1beta1.IDelegationResponse, + ): cosmos.staking.v1beta1.DelegationResponse; + + /** + * Encodes the specified DelegationResponse message. Does not implicitly {@link cosmos.staking.v1beta1.DelegationResponse.verify|verify} messages. + * @param m DelegationResponse message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode( + m: cosmos.staking.v1beta1.IDelegationResponse, + w?: $protobuf.Writer, + ): $protobuf.Writer; + + /** + * Decodes a DelegationResponse message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns DelegationResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode( + r: $protobuf.Reader | Uint8Array, + l?: number, + ): cosmos.staking.v1beta1.DelegationResponse; + } + + /** Properties of a RedelegationEntryResponse. */ + interface IRedelegationEntryResponse { + /** RedelegationEntryResponse redelegationEntry */ + redelegationEntry?: cosmos.staking.v1beta1.IRedelegationEntry | null; + + /** RedelegationEntryResponse balance */ + balance?: string | null; + } + + /** Represents a RedelegationEntryResponse. */ + class RedelegationEntryResponse implements IRedelegationEntryResponse { + /** + * Constructs a new RedelegationEntryResponse. + * @param [p] Properties to set + */ + constructor(p?: cosmos.staking.v1beta1.IRedelegationEntryResponse); + + /** RedelegationEntryResponse redelegationEntry. */ + public redelegationEntry?: cosmos.staking.v1beta1.IRedelegationEntry | null; + + /** RedelegationEntryResponse balance. */ + public balance: string; + + /** + * Creates a new RedelegationEntryResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns RedelegationEntryResponse instance + */ + public static create( + properties?: cosmos.staking.v1beta1.IRedelegationEntryResponse, + ): cosmos.staking.v1beta1.RedelegationEntryResponse; + + /** + * Encodes the specified RedelegationEntryResponse message. Does not implicitly {@link cosmos.staking.v1beta1.RedelegationEntryResponse.verify|verify} messages. + * @param m RedelegationEntryResponse message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode( + m: cosmos.staking.v1beta1.IRedelegationEntryResponse, + w?: $protobuf.Writer, + ): $protobuf.Writer; + + /** + * Decodes a RedelegationEntryResponse message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns RedelegationEntryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode( + r: $protobuf.Reader | Uint8Array, + l?: number, + ): cosmos.staking.v1beta1.RedelegationEntryResponse; + } + + /** Properties of a RedelegationResponse. */ + interface IRedelegationResponse { + /** RedelegationResponse redelegation */ + redelegation?: cosmos.staking.v1beta1.IRedelegation | null; + + /** RedelegationResponse entries */ + entries?: cosmos.staking.v1beta1.IRedelegationEntryResponse[] | null; + } + + /** Represents a RedelegationResponse. */ + class RedelegationResponse implements IRedelegationResponse { + /** + * Constructs a new RedelegationResponse. + * @param [p] Properties to set + */ + constructor(p?: cosmos.staking.v1beta1.IRedelegationResponse); + + /** RedelegationResponse redelegation. */ + public redelegation?: cosmos.staking.v1beta1.IRedelegation | null; + + /** RedelegationResponse entries. */ + public entries: cosmos.staking.v1beta1.IRedelegationEntryResponse[]; + + /** + * Creates a new RedelegationResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns RedelegationResponse instance + */ + public static create( + properties?: cosmos.staking.v1beta1.IRedelegationResponse, + ): cosmos.staking.v1beta1.RedelegationResponse; + + /** + * Encodes the specified RedelegationResponse message. Does not implicitly {@link cosmos.staking.v1beta1.RedelegationResponse.verify|verify} messages. + * @param m RedelegationResponse message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode( + m: cosmos.staking.v1beta1.IRedelegationResponse, + w?: $protobuf.Writer, + ): $protobuf.Writer; + + /** + * Decodes a RedelegationResponse message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns RedelegationResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode( + r: $protobuf.Reader | Uint8Array, + l?: number, + ): cosmos.staking.v1beta1.RedelegationResponse; + } + + /** Properties of a Pool. */ + interface IPool { + /** Pool notBondedTokens */ + notBondedTokens?: string | null; + + /** Pool bondedTokens */ + bondedTokens?: string | null; + } + + /** Represents a Pool. */ + class Pool implements IPool { + /** + * Constructs a new Pool. + * @param [p] Properties to set + */ + constructor(p?: cosmos.staking.v1beta1.IPool); + + /** Pool notBondedTokens. */ + public notBondedTokens: string; + + /** Pool bondedTokens. */ + public bondedTokens: string; + + /** + * Creates a new Pool instance using the specified properties. + * @param [properties] Properties to set + * @returns Pool instance + */ + public static create(properties?: cosmos.staking.v1beta1.IPool): cosmos.staking.v1beta1.Pool; + + /** + * Encodes the specified Pool message. Does not implicitly {@link cosmos.staking.v1beta1.Pool.verify|verify} messages. + * @param m Pool message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: cosmos.staking.v1beta1.IPool, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Pool message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns Pool + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): cosmos.staking.v1beta1.Pool; + } + + /** Properties of a MsgCreateValidator. */ + interface IMsgCreateValidator { + /** MsgCreateValidator description */ + description?: cosmos.staking.v1beta1.IDescription | null; + + /** MsgCreateValidator commission */ + commission?: cosmos.staking.v1beta1.ICommissionRates | null; + + /** MsgCreateValidator minSelfDelegation */ + minSelfDelegation?: string | null; + + /** MsgCreateValidator delegatorAddress */ + delegatorAddress?: string | null; + + /** MsgCreateValidator validatorAddress */ + validatorAddress?: string | null; + + /** MsgCreateValidator pubkey */ + pubkey?: string | null; + + /** MsgCreateValidator value */ + value?: cosmos.base.v1beta1.ICoin | null; + } + + /** Represents a MsgCreateValidator. */ + class MsgCreateValidator implements IMsgCreateValidator { + /** + * Constructs a new MsgCreateValidator. + * @param [p] Properties to set + */ + constructor(p?: cosmos.staking.v1beta1.IMsgCreateValidator); + + /** MsgCreateValidator description. */ + public description?: cosmos.staking.v1beta1.IDescription | null; + + /** MsgCreateValidator commission. */ + public commission?: cosmos.staking.v1beta1.ICommissionRates | null; + + /** MsgCreateValidator minSelfDelegation. */ + public minSelfDelegation: string; + + /** MsgCreateValidator delegatorAddress. */ + public delegatorAddress: string; + + /** MsgCreateValidator validatorAddress. */ + public validatorAddress: string; + + /** MsgCreateValidator pubkey. */ + public pubkey: string; + + /** MsgCreateValidator value. */ + public value?: cosmos.base.v1beta1.ICoin | null; + + /** + * Creates a new MsgCreateValidator instance using the specified properties. + * @param [properties] Properties to set + * @returns MsgCreateValidator instance + */ + public static create( + properties?: cosmos.staking.v1beta1.IMsgCreateValidator, + ): cosmos.staking.v1beta1.MsgCreateValidator; + + /** + * Encodes the specified MsgCreateValidator message. Does not implicitly {@link cosmos.staking.v1beta1.MsgCreateValidator.verify|verify} messages. + * @param m MsgCreateValidator message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode( + m: cosmos.staking.v1beta1.IMsgCreateValidator, + w?: $protobuf.Writer, + ): $protobuf.Writer; + + /** + * Decodes a MsgCreateValidator message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns MsgCreateValidator + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode( + r: $protobuf.Reader | Uint8Array, + l?: number, + ): cosmos.staking.v1beta1.MsgCreateValidator; + } + + /** Properties of a MsgEditValidator. */ + interface IMsgEditValidator { + /** MsgEditValidator description */ + description?: cosmos.staking.v1beta1.IDescription | null; + + /** MsgEditValidator validatorAddress */ + validatorAddress?: string | null; + + /** MsgEditValidator commissionRate */ + commissionRate?: string | null; + + /** MsgEditValidator minSelfDelegation */ + minSelfDelegation?: string | null; + } + + /** Represents a MsgEditValidator. */ + class MsgEditValidator implements IMsgEditValidator { + /** + * Constructs a new MsgEditValidator. + * @param [p] Properties to set + */ + constructor(p?: cosmos.staking.v1beta1.IMsgEditValidator); + + /** MsgEditValidator description. */ + public description?: cosmos.staking.v1beta1.IDescription | null; + + /** MsgEditValidator validatorAddress. */ + public validatorAddress: string; + + /** MsgEditValidator commissionRate. */ + public commissionRate: string; + + /** MsgEditValidator minSelfDelegation. */ + public minSelfDelegation: string; + + /** + * Creates a new MsgEditValidator instance using the specified properties. + * @param [properties] Properties to set + * @returns MsgEditValidator instance + */ + public static create( + properties?: cosmos.staking.v1beta1.IMsgEditValidator, + ): cosmos.staking.v1beta1.MsgEditValidator; + + /** + * Encodes the specified MsgEditValidator message. Does not implicitly {@link cosmos.staking.v1beta1.MsgEditValidator.verify|verify} messages. + * @param m MsgEditValidator message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode( + m: cosmos.staking.v1beta1.IMsgEditValidator, + w?: $protobuf.Writer, + ): $protobuf.Writer; + + /** + * Decodes a MsgEditValidator message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns MsgEditValidator + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode( + r: $protobuf.Reader | Uint8Array, + l?: number, + ): cosmos.staking.v1beta1.MsgEditValidator; + } + + /** Properties of a MsgDelegate. */ + interface IMsgDelegate { + /** MsgDelegate delegatorAddress */ + delegatorAddress?: string | null; + + /** MsgDelegate validatorAddress */ + validatorAddress?: string | null; + + /** MsgDelegate amount */ + amount?: cosmos.base.v1beta1.ICoin | null; + } + + /** Represents a MsgDelegate. */ + class MsgDelegate implements IMsgDelegate { + /** + * Constructs a new MsgDelegate. + * @param [p] Properties to set + */ + constructor(p?: cosmos.staking.v1beta1.IMsgDelegate); + + /** MsgDelegate delegatorAddress. */ + public delegatorAddress: string; + + /** MsgDelegate validatorAddress. */ + public validatorAddress: string; + + /** MsgDelegate amount. */ + public amount?: cosmos.base.v1beta1.ICoin | null; + + /** + * Creates a new MsgDelegate instance using the specified properties. + * @param [properties] Properties to set + * @returns MsgDelegate instance + */ + public static create( + properties?: cosmos.staking.v1beta1.IMsgDelegate, + ): cosmos.staking.v1beta1.MsgDelegate; + + /** + * Encodes the specified MsgDelegate message. Does not implicitly {@link cosmos.staking.v1beta1.MsgDelegate.verify|verify} messages. + * @param m MsgDelegate message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: cosmos.staking.v1beta1.IMsgDelegate, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MsgDelegate message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns MsgDelegate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode( + r: $protobuf.Reader | Uint8Array, + l?: number, + ): cosmos.staking.v1beta1.MsgDelegate; + } + + /** Properties of a MsgBeginRedelegate. */ + interface IMsgBeginRedelegate { + /** MsgBeginRedelegate delegatorAddress */ + delegatorAddress?: string | null; + + /** MsgBeginRedelegate validatorSrcAddress */ + validatorSrcAddress?: string | null; + + /** MsgBeginRedelegate validatorDstAddress */ + validatorDstAddress?: string | null; + + /** MsgBeginRedelegate amount */ + amount?: cosmos.base.v1beta1.ICoin | null; + } + + /** Represents a MsgBeginRedelegate. */ + class MsgBeginRedelegate implements IMsgBeginRedelegate { + /** + * Constructs a new MsgBeginRedelegate. + * @param [p] Properties to set + */ + constructor(p?: cosmos.staking.v1beta1.IMsgBeginRedelegate); + + /** MsgBeginRedelegate delegatorAddress. */ + public delegatorAddress: string; + + /** MsgBeginRedelegate validatorSrcAddress. */ + public validatorSrcAddress: string; + + /** MsgBeginRedelegate validatorDstAddress. */ + public validatorDstAddress: string; + + /** MsgBeginRedelegate amount. */ + public amount?: cosmos.base.v1beta1.ICoin | null; + + /** + * Creates a new MsgBeginRedelegate instance using the specified properties. + * @param [properties] Properties to set + * @returns MsgBeginRedelegate instance + */ + public static create( + properties?: cosmos.staking.v1beta1.IMsgBeginRedelegate, + ): cosmos.staking.v1beta1.MsgBeginRedelegate; + + /** + * Encodes the specified MsgBeginRedelegate message. Does not implicitly {@link cosmos.staking.v1beta1.MsgBeginRedelegate.verify|verify} messages. + * @param m MsgBeginRedelegate message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode( + m: cosmos.staking.v1beta1.IMsgBeginRedelegate, + w?: $protobuf.Writer, + ): $protobuf.Writer; + + /** + * Decodes a MsgBeginRedelegate message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns MsgBeginRedelegate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode( + r: $protobuf.Reader | Uint8Array, + l?: number, + ): cosmos.staking.v1beta1.MsgBeginRedelegate; + } + + /** Properties of a MsgUndelegate. */ + interface IMsgUndelegate { + /** MsgUndelegate delegatorAddress */ + delegatorAddress?: string | null; + + /** MsgUndelegate validatorAddress */ + validatorAddress?: string | null; + + /** MsgUndelegate amount */ + amount?: cosmos.base.v1beta1.ICoin | null; + } + + /** Represents a MsgUndelegate. */ + class MsgUndelegate implements IMsgUndelegate { + /** + * Constructs a new MsgUndelegate. + * @param [p] Properties to set + */ + constructor(p?: cosmos.staking.v1beta1.IMsgUndelegate); + + /** MsgUndelegate delegatorAddress. */ + public delegatorAddress: string; + + /** MsgUndelegate validatorAddress. */ + public validatorAddress: string; + + /** MsgUndelegate amount. */ + public amount?: cosmos.base.v1beta1.ICoin | null; + + /** + * Creates a new MsgUndelegate instance using the specified properties. + * @param [properties] Properties to set + * @returns MsgUndelegate instance + */ + public static create( + properties?: cosmos.staking.v1beta1.IMsgUndelegate, + ): cosmos.staking.v1beta1.MsgUndelegate; + + /** + * Encodes the specified MsgUndelegate message. Does not implicitly {@link cosmos.staking.v1beta1.MsgUndelegate.verify|verify} messages. + * @param m MsgUndelegate message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode( + m: cosmos.staking.v1beta1.IMsgUndelegate, + w?: $protobuf.Writer, + ): $protobuf.Writer; + + /** + * Decodes a MsgUndelegate message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns MsgUndelegate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode( + r: $protobuf.Reader | Uint8Array, + l?: number, + ): cosmos.staking.v1beta1.MsgUndelegate; + } + } + } + /** Namespace tx. */ namespace tx { /** Namespace signing. */ @@ -4358,6 +5916,104 @@ export namespace google { ): google.protobuf.GeneratedCodeInfo.Annotation; } } + + /** Properties of a Timestamp. */ + interface ITimestamp { + /** Timestamp seconds */ + seconds?: Long | null; + + /** Timestamp nanos */ + nanos?: number | null; + } + + /** Represents a Timestamp. */ + class Timestamp implements ITimestamp { + /** + * Constructs a new Timestamp. + * @param [p] Properties to set + */ + constructor(p?: google.protobuf.ITimestamp); + + /** Timestamp seconds. */ + public seconds: Long; + + /** Timestamp nanos. */ + public nanos: number; + + /** + * Creates a new Timestamp instance using the specified properties. + * @param [properties] Properties to set + * @returns Timestamp instance + */ + public static create(properties?: google.protobuf.ITimestamp): google.protobuf.Timestamp; + + /** + * Encodes the specified Timestamp message. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. + * @param m Timestamp message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: google.protobuf.ITimestamp, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Timestamp message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns Timestamp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): google.protobuf.Timestamp; + } + + /** Properties of a Duration. */ + interface IDuration { + /** Duration seconds */ + seconds?: Long | null; + + /** Duration nanos */ + nanos?: number | null; + } + + /** Represents a Duration. */ + class Duration implements IDuration { + /** + * Constructs a new Duration. + * @param [p] Properties to set + */ + constructor(p?: google.protobuf.IDuration); + + /** Duration seconds. */ + public seconds: Long; + + /** Duration nanos. */ + public nanos: number; + + /** + * Creates a new Duration instance using the specified properties. + * @param [properties] Properties to set + * @returns Duration instance + */ + public static create(properties?: google.protobuf.IDuration): google.protobuf.Duration; + + /** + * Encodes the specified Duration message. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * @param m Duration message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: google.protobuf.IDuration, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Duration message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns Duration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): google.protobuf.Duration; + } } /** Namespace api. */ @@ -9880,6 +11536,52 @@ export namespace ibc { export namespace tendermint { /** Namespace crypto. */ namespace crypto { + /** Properties of a PublicKey. */ + interface IPublicKey { + /** PublicKey ed25519 */ + ed25519?: Uint8Array | null; + } + + /** Represents a PublicKey. */ + class PublicKey implements IPublicKey { + /** + * Constructs a new PublicKey. + * @param [p] Properties to set + */ + constructor(p?: tendermint.crypto.IPublicKey); + + /** PublicKey ed25519. */ + public ed25519: Uint8Array; + + /** PublicKey sum. */ + public sum?: "ed25519"; + + /** + * Creates a new PublicKey instance using the specified properties. + * @param [properties] Properties to set + * @returns PublicKey instance + */ + public static create(properties?: tendermint.crypto.IPublicKey): tendermint.crypto.PublicKey; + + /** + * Encodes the specified PublicKey message. Does not implicitly {@link tendermint.crypto.PublicKey.verify|verify} messages. + * @param m PublicKey message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: tendermint.crypto.IPublicKey, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PublicKey message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns PublicKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): tendermint.crypto.PublicKey; + } + /** Properties of a Proof. */ interface IProof { /** Proof total */ @@ -10143,4 +11845,1179 @@ export namespace tendermint { public static decode(r: $protobuf.Reader | Uint8Array, l?: number): tendermint.crypto.ProofOps; } } + + /** Namespace libs. */ + namespace libs { + /** Namespace bits. */ + namespace bits { + /** Properties of a BitArray. */ + interface IBitArray { + /** BitArray bits */ + bits?: Long | null; + + /** BitArray elems */ + elems?: Long[] | null; + } + + /** Represents a BitArray. */ + class BitArray implements IBitArray { + /** + * Constructs a new BitArray. + * @param [p] Properties to set + */ + constructor(p?: tendermint.libs.bits.IBitArray); + + /** BitArray bits. */ + public bits: Long; + + /** BitArray elems. */ + public elems: Long[]; + + /** + * Creates a new BitArray instance using the specified properties. + * @param [properties] Properties to set + * @returns BitArray instance + */ + public static create(properties?: tendermint.libs.bits.IBitArray): tendermint.libs.bits.BitArray; + + /** + * Encodes the specified BitArray message. Does not implicitly {@link tendermint.libs.bits.BitArray.verify|verify} messages. + * @param m BitArray message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: tendermint.libs.bits.IBitArray, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BitArray message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns BitArray + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): tendermint.libs.bits.BitArray; + } + } + } + + /** Namespace types. */ + namespace types { + /** BlockIDFlag enum. */ + enum BlockIDFlag { + BLOCK_ID_FLAG_UNKNOWN = 0, + BLOCK_ID_FLAG_ABSENT = 1, + BLOCK_ID_FLAG_COMMIT = 2, + BLOCK_ID_FLAG_NIL = 3, + } + + /** SignedMsgType enum. */ + enum SignedMsgType { + SIGNED_MSG_TYPE_UNKNOWN = 0, + SIGNED_MSG_TYPE_PREVOTE = 1, + SIGNED_MSG_TYPE_PRECOMMIT = 2, + SIGNED_MSG_TYPE_PROPOSAL = 32, + } + + /** Properties of a PartSetHeader. */ + interface IPartSetHeader { + /** PartSetHeader total */ + total?: number | null; + + /** PartSetHeader hash */ + hash?: Uint8Array | null; + } + + /** Represents a PartSetHeader. */ + class PartSetHeader implements IPartSetHeader { + /** + * Constructs a new PartSetHeader. + * @param [p] Properties to set + */ + constructor(p?: tendermint.types.IPartSetHeader); + + /** PartSetHeader total. */ + public total: number; + + /** PartSetHeader hash. */ + public hash: Uint8Array; + + /** + * Creates a new PartSetHeader instance using the specified properties. + * @param [properties] Properties to set + * @returns PartSetHeader instance + */ + public static create(properties?: tendermint.types.IPartSetHeader): tendermint.types.PartSetHeader; + + /** + * Encodes the specified PartSetHeader message. Does not implicitly {@link tendermint.types.PartSetHeader.verify|verify} messages. + * @param m PartSetHeader message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: tendermint.types.IPartSetHeader, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PartSetHeader message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns PartSetHeader + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): tendermint.types.PartSetHeader; + } + + /** Properties of a Part. */ + interface IPart { + /** Part index */ + index?: number | null; + + /** Part bytes */ + bytes?: Uint8Array | null; + + /** Part proof */ + proof?: tendermint.crypto.IProof | null; + } + + /** Represents a Part. */ + class Part implements IPart { + /** + * Constructs a new Part. + * @param [p] Properties to set + */ + constructor(p?: tendermint.types.IPart); + + /** Part index. */ + public index: number; + + /** Part bytes. */ + public bytes: Uint8Array; + + /** Part proof. */ + public proof?: tendermint.crypto.IProof | null; + + /** + * Creates a new Part instance using the specified properties. + * @param [properties] Properties to set + * @returns Part instance + */ + public static create(properties?: tendermint.types.IPart): tendermint.types.Part; + + /** + * Encodes the specified Part message. Does not implicitly {@link tendermint.types.Part.verify|verify} messages. + * @param m Part message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: tendermint.types.IPart, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Part message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns Part + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): tendermint.types.Part; + } + + /** Properties of a BlockID. */ + interface IBlockID { + /** BlockID hash */ + hash?: Uint8Array | null; + + /** BlockID partSetHeader */ + partSetHeader?: tendermint.types.IPartSetHeader | null; + } + + /** Represents a BlockID. */ + class BlockID implements IBlockID { + /** + * Constructs a new BlockID. + * @param [p] Properties to set + */ + constructor(p?: tendermint.types.IBlockID); + + /** BlockID hash. */ + public hash: Uint8Array; + + /** BlockID partSetHeader. */ + public partSetHeader?: tendermint.types.IPartSetHeader | null; + + /** + * Creates a new BlockID instance using the specified properties. + * @param [properties] Properties to set + * @returns BlockID instance + */ + public static create(properties?: tendermint.types.IBlockID): tendermint.types.BlockID; + + /** + * Encodes the specified BlockID message. Does not implicitly {@link tendermint.types.BlockID.verify|verify} messages. + * @param m BlockID message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: tendermint.types.IBlockID, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BlockID message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns BlockID + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): tendermint.types.BlockID; + } + + /** Properties of a Header. */ + interface IHeader { + /** Header version */ + version?: tendermint.version.IConsensus | null; + + /** Header chainId */ + chainId?: string | null; + + /** Header height */ + height?: Long | null; + + /** Header time */ + time?: google.protobuf.ITimestamp | null; + + /** Header lastBlockId */ + lastBlockId?: tendermint.types.IBlockID | null; + + /** Header lastCommitHash */ + lastCommitHash?: Uint8Array | null; + + /** Header dataHash */ + dataHash?: Uint8Array | null; + + /** Header validatorsHash */ + validatorsHash?: Uint8Array | null; + + /** Header nextValidatorsHash */ + nextValidatorsHash?: Uint8Array | null; + + /** Header consensusHash */ + consensusHash?: Uint8Array | null; + + /** Header appHash */ + appHash?: Uint8Array | null; + + /** Header lastResultsHash */ + lastResultsHash?: Uint8Array | null; + + /** Header evidenceHash */ + evidenceHash?: Uint8Array | null; + + /** Header proposerAddress */ + proposerAddress?: Uint8Array | null; + } + + /** Represents a Header. */ + class Header implements IHeader { + /** + * Constructs a new Header. + * @param [p] Properties to set + */ + constructor(p?: tendermint.types.IHeader); + + /** Header version. */ + public version?: tendermint.version.IConsensus | null; + + /** Header chainId. */ + public chainId: string; + + /** Header height. */ + public height: Long; + + /** Header time. */ + public time?: google.protobuf.ITimestamp | null; + + /** Header lastBlockId. */ + public lastBlockId?: tendermint.types.IBlockID | null; + + /** Header lastCommitHash. */ + public lastCommitHash: Uint8Array; + + /** Header dataHash. */ + public dataHash: Uint8Array; + + /** Header validatorsHash. */ + public validatorsHash: Uint8Array; + + /** Header nextValidatorsHash. */ + public nextValidatorsHash: Uint8Array; + + /** Header consensusHash. */ + public consensusHash: Uint8Array; + + /** Header appHash. */ + public appHash: Uint8Array; + + /** Header lastResultsHash. */ + public lastResultsHash: Uint8Array; + + /** Header evidenceHash. */ + public evidenceHash: Uint8Array; + + /** Header proposerAddress. */ + public proposerAddress: Uint8Array; + + /** + * Creates a new Header instance using the specified properties. + * @param [properties] Properties to set + * @returns Header instance + */ + public static create(properties?: tendermint.types.IHeader): tendermint.types.Header; + + /** + * Encodes the specified Header message. Does not implicitly {@link tendermint.types.Header.verify|verify} messages. + * @param m Header message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: tendermint.types.IHeader, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Header message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns Header + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): tendermint.types.Header; + } + + /** Properties of a Data. */ + interface IData { + /** Data txs */ + txs?: Uint8Array[] | null; + + /** Data hash */ + hash?: Uint8Array | null; + } + + /** Represents a Data. */ + class Data implements IData { + /** + * Constructs a new Data. + * @param [p] Properties to set + */ + constructor(p?: tendermint.types.IData); + + /** Data txs. */ + public txs: Uint8Array[]; + + /** Data hash. */ + public hash: Uint8Array; + + /** + * Creates a new Data instance using the specified properties. + * @param [properties] Properties to set + * @returns Data instance + */ + public static create(properties?: tendermint.types.IData): tendermint.types.Data; + + /** + * Encodes the specified Data message. Does not implicitly {@link tendermint.types.Data.verify|verify} messages. + * @param m Data message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: tendermint.types.IData, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Data message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns Data + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): tendermint.types.Data; + } + + /** Properties of a Vote. */ + interface IVote { + /** Vote type */ + type?: tendermint.types.SignedMsgType | null; + + /** Vote height */ + height?: Long | null; + + /** Vote round */ + round?: number | null; + + /** Vote blockId */ + blockId?: tendermint.types.IBlockID | null; + + /** Vote timestamp */ + timestamp?: google.protobuf.ITimestamp | null; + + /** Vote validatorAddress */ + validatorAddress?: Uint8Array | null; + + /** Vote validatorIndex */ + validatorIndex?: number | null; + + /** Vote signature */ + signature?: Uint8Array | null; + } + + /** Represents a Vote. */ + class Vote implements IVote { + /** + * Constructs a new Vote. + * @param [p] Properties to set + */ + constructor(p?: tendermint.types.IVote); + + /** Vote type. */ + public type: tendermint.types.SignedMsgType; + + /** Vote height. */ + public height: Long; + + /** Vote round. */ + public round: number; + + /** Vote blockId. */ + public blockId?: tendermint.types.IBlockID | null; + + /** Vote timestamp. */ + public timestamp?: google.protobuf.ITimestamp | null; + + /** Vote validatorAddress. */ + public validatorAddress: Uint8Array; + + /** Vote validatorIndex. */ + public validatorIndex: number; + + /** Vote signature. */ + public signature: Uint8Array; + + /** + * Creates a new Vote instance using the specified properties. + * @param [properties] Properties to set + * @returns Vote instance + */ + public static create(properties?: tendermint.types.IVote): tendermint.types.Vote; + + /** + * Encodes the specified Vote message. Does not implicitly {@link tendermint.types.Vote.verify|verify} messages. + * @param m Vote message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: tendermint.types.IVote, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Vote message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns Vote + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): tendermint.types.Vote; + } + + /** Properties of a Commit. */ + interface ICommit { + /** Commit height */ + height?: Long | null; + + /** Commit round */ + round?: number | null; + + /** Commit blockId */ + blockId?: tendermint.types.IBlockID | null; + + /** Commit signatures */ + signatures?: tendermint.types.ICommitSig[] | null; + + /** Commit hash */ + hash?: Uint8Array | null; + + /** Commit bitArray */ + bitArray?: tendermint.libs.bits.IBitArray | null; + } + + /** Represents a Commit. */ + class Commit implements ICommit { + /** + * Constructs a new Commit. + * @param [p] Properties to set + */ + constructor(p?: tendermint.types.ICommit); + + /** Commit height. */ + public height: Long; + + /** Commit round. */ + public round: number; + + /** Commit blockId. */ + public blockId?: tendermint.types.IBlockID | null; + + /** Commit signatures. */ + public signatures: tendermint.types.ICommitSig[]; + + /** Commit hash. */ + public hash: Uint8Array; + + /** Commit bitArray. */ + public bitArray?: tendermint.libs.bits.IBitArray | null; + + /** + * Creates a new Commit instance using the specified properties. + * @param [properties] Properties to set + * @returns Commit instance + */ + public static create(properties?: tendermint.types.ICommit): tendermint.types.Commit; + + /** + * Encodes the specified Commit message. Does not implicitly {@link tendermint.types.Commit.verify|verify} messages. + * @param m Commit message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: tendermint.types.ICommit, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Commit message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns Commit + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): tendermint.types.Commit; + } + + /** Properties of a CommitSig. */ + interface ICommitSig { + /** CommitSig blockIdFlag */ + blockIdFlag?: tendermint.types.BlockIDFlag | null; + + /** CommitSig validatorAddress */ + validatorAddress?: Uint8Array | null; + + /** CommitSig timestamp */ + timestamp?: google.protobuf.ITimestamp | null; + + /** CommitSig signature */ + signature?: Uint8Array | null; + } + + /** Represents a CommitSig. */ + class CommitSig implements ICommitSig { + /** + * Constructs a new CommitSig. + * @param [p] Properties to set + */ + constructor(p?: tendermint.types.ICommitSig); + + /** CommitSig blockIdFlag. */ + public blockIdFlag: tendermint.types.BlockIDFlag; + + /** CommitSig validatorAddress. */ + public validatorAddress: Uint8Array; + + /** CommitSig timestamp. */ + public timestamp?: google.protobuf.ITimestamp | null; + + /** CommitSig signature. */ + public signature: Uint8Array; + + /** + * Creates a new CommitSig instance using the specified properties. + * @param [properties] Properties to set + * @returns CommitSig instance + */ + public static create(properties?: tendermint.types.ICommitSig): tendermint.types.CommitSig; + + /** + * Encodes the specified CommitSig message. Does not implicitly {@link tendermint.types.CommitSig.verify|verify} messages. + * @param m CommitSig message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: tendermint.types.ICommitSig, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CommitSig message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns CommitSig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): tendermint.types.CommitSig; + } + + /** Properties of a Proposal. */ + interface IProposal { + /** Proposal type */ + type?: tendermint.types.SignedMsgType | null; + + /** Proposal height */ + height?: Long | null; + + /** Proposal round */ + round?: number | null; + + /** Proposal polRound */ + polRound?: number | null; + + /** Proposal blockId */ + blockId?: tendermint.types.IBlockID | null; + + /** Proposal timestamp */ + timestamp?: google.protobuf.ITimestamp | null; + + /** Proposal signature */ + signature?: Uint8Array | null; + } + + /** Represents a Proposal. */ + class Proposal implements IProposal { + /** + * Constructs a new Proposal. + * @param [p] Properties to set + */ + constructor(p?: tendermint.types.IProposal); + + /** Proposal type. */ + public type: tendermint.types.SignedMsgType; + + /** Proposal height. */ + public height: Long; + + /** Proposal round. */ + public round: number; + + /** Proposal polRound. */ + public polRound: number; + + /** Proposal blockId. */ + public blockId?: tendermint.types.IBlockID | null; + + /** Proposal timestamp. */ + public timestamp?: google.protobuf.ITimestamp | null; + + /** Proposal signature. */ + public signature: Uint8Array; + + /** + * Creates a new Proposal instance using the specified properties. + * @param [properties] Properties to set + * @returns Proposal instance + */ + public static create(properties?: tendermint.types.IProposal): tendermint.types.Proposal; + + /** + * Encodes the specified Proposal message. Does not implicitly {@link tendermint.types.Proposal.verify|verify} messages. + * @param m Proposal message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: tendermint.types.IProposal, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Proposal message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns Proposal + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): tendermint.types.Proposal; + } + + /** Properties of a SignedHeader. */ + interface ISignedHeader { + /** SignedHeader header */ + header?: tendermint.types.IHeader | null; + + /** SignedHeader commit */ + commit?: tendermint.types.ICommit | null; + } + + /** Represents a SignedHeader. */ + class SignedHeader implements ISignedHeader { + /** + * Constructs a new SignedHeader. + * @param [p] Properties to set + */ + constructor(p?: tendermint.types.ISignedHeader); + + /** SignedHeader header. */ + public header?: tendermint.types.IHeader | null; + + /** SignedHeader commit. */ + public commit?: tendermint.types.ICommit | null; + + /** + * Creates a new SignedHeader instance using the specified properties. + * @param [properties] Properties to set + * @returns SignedHeader instance + */ + public static create(properties?: tendermint.types.ISignedHeader): tendermint.types.SignedHeader; + + /** + * Encodes the specified SignedHeader message. Does not implicitly {@link tendermint.types.SignedHeader.verify|verify} messages. + * @param m SignedHeader message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: tendermint.types.ISignedHeader, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SignedHeader message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns SignedHeader + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): tendermint.types.SignedHeader; + } + + /** Properties of a LightBlock. */ + interface ILightBlock { + /** LightBlock signedHeader */ + signedHeader?: tendermint.types.ISignedHeader | null; + + /** LightBlock validatorSet */ + validatorSet?: tendermint.types.IValidatorSet | null; + } + + /** Represents a LightBlock. */ + class LightBlock implements ILightBlock { + /** + * Constructs a new LightBlock. + * @param [p] Properties to set + */ + constructor(p?: tendermint.types.ILightBlock); + + /** LightBlock signedHeader. */ + public signedHeader?: tendermint.types.ISignedHeader | null; + + /** LightBlock validatorSet. */ + public validatorSet?: tendermint.types.IValidatorSet | null; + + /** + * Creates a new LightBlock instance using the specified properties. + * @param [properties] Properties to set + * @returns LightBlock instance + */ + public static create(properties?: tendermint.types.ILightBlock): tendermint.types.LightBlock; + + /** + * Encodes the specified LightBlock message. Does not implicitly {@link tendermint.types.LightBlock.verify|verify} messages. + * @param m LightBlock message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: tendermint.types.ILightBlock, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LightBlock message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns LightBlock + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): tendermint.types.LightBlock; + } + + /** Properties of a BlockMeta. */ + interface IBlockMeta { + /** BlockMeta blockId */ + blockId?: tendermint.types.IBlockID | null; + + /** BlockMeta blockSize */ + blockSize?: Long | null; + + /** BlockMeta header */ + header?: tendermint.types.IHeader | null; + + /** BlockMeta numTxs */ + numTxs?: Long | null; + } + + /** Represents a BlockMeta. */ + class BlockMeta implements IBlockMeta { + /** + * Constructs a new BlockMeta. + * @param [p] Properties to set + */ + constructor(p?: tendermint.types.IBlockMeta); + + /** BlockMeta blockId. */ + public blockId?: tendermint.types.IBlockID | null; + + /** BlockMeta blockSize. */ + public blockSize: Long; + + /** BlockMeta header. */ + public header?: tendermint.types.IHeader | null; + + /** BlockMeta numTxs. */ + public numTxs: Long; + + /** + * Creates a new BlockMeta instance using the specified properties. + * @param [properties] Properties to set + * @returns BlockMeta instance + */ + public static create(properties?: tendermint.types.IBlockMeta): tendermint.types.BlockMeta; + + /** + * Encodes the specified BlockMeta message. Does not implicitly {@link tendermint.types.BlockMeta.verify|verify} messages. + * @param m BlockMeta message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: tendermint.types.IBlockMeta, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BlockMeta message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns BlockMeta + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): tendermint.types.BlockMeta; + } + + /** Properties of a TxProof. */ + interface ITxProof { + /** TxProof rootHash */ + rootHash?: Uint8Array | null; + + /** TxProof data */ + data?: Uint8Array | null; + + /** TxProof proof */ + proof?: tendermint.crypto.IProof | null; + } + + /** Represents a TxProof. */ + class TxProof implements ITxProof { + /** + * Constructs a new TxProof. + * @param [p] Properties to set + */ + constructor(p?: tendermint.types.ITxProof); + + /** TxProof rootHash. */ + public rootHash: Uint8Array; + + /** TxProof data. */ + public data: Uint8Array; + + /** TxProof proof. */ + public proof?: tendermint.crypto.IProof | null; + + /** + * Creates a new TxProof instance using the specified properties. + * @param [properties] Properties to set + * @returns TxProof instance + */ + public static create(properties?: tendermint.types.ITxProof): tendermint.types.TxProof; + + /** + * Encodes the specified TxProof message. Does not implicitly {@link tendermint.types.TxProof.verify|verify} messages. + * @param m TxProof message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: tendermint.types.ITxProof, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TxProof message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns TxProof + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): tendermint.types.TxProof; + } + + /** Properties of a ValidatorSet. */ + interface IValidatorSet { + /** ValidatorSet validators */ + validators?: tendermint.types.IValidator[] | null; + + /** ValidatorSet proposer */ + proposer?: tendermint.types.IValidator | null; + + /** ValidatorSet totalVotingPower */ + totalVotingPower?: Long | null; + } + + /** Represents a ValidatorSet. */ + class ValidatorSet implements IValidatorSet { + /** + * Constructs a new ValidatorSet. + * @param [p] Properties to set + */ + constructor(p?: tendermint.types.IValidatorSet); + + /** ValidatorSet validators. */ + public validators: tendermint.types.IValidator[]; + + /** ValidatorSet proposer. */ + public proposer?: tendermint.types.IValidator | null; + + /** ValidatorSet totalVotingPower. */ + public totalVotingPower: Long; + + /** + * Creates a new ValidatorSet instance using the specified properties. + * @param [properties] Properties to set + * @returns ValidatorSet instance + */ + public static create(properties?: tendermint.types.IValidatorSet): tendermint.types.ValidatorSet; + + /** + * Encodes the specified ValidatorSet message. Does not implicitly {@link tendermint.types.ValidatorSet.verify|verify} messages. + * @param m ValidatorSet message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: tendermint.types.IValidatorSet, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ValidatorSet message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns ValidatorSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): tendermint.types.ValidatorSet; + } + + /** Properties of a Validator. */ + interface IValidator { + /** Validator address */ + address?: Uint8Array | null; + + /** Validator pubKey */ + pubKey?: tendermint.crypto.IPublicKey | null; + + /** Validator votingPower */ + votingPower?: Long | null; + + /** Validator proposerPriority */ + proposerPriority?: Long | null; + } + + /** Represents a Validator. */ + class Validator implements IValidator { + /** + * Constructs a new Validator. + * @param [p] Properties to set + */ + constructor(p?: tendermint.types.IValidator); + + /** Validator address. */ + public address: Uint8Array; + + /** Validator pubKey. */ + public pubKey?: tendermint.crypto.IPublicKey | null; + + /** Validator votingPower. */ + public votingPower: Long; + + /** Validator proposerPriority. */ + public proposerPriority: Long; + + /** + * Creates a new Validator instance using the specified properties. + * @param [properties] Properties to set + * @returns Validator instance + */ + public static create(properties?: tendermint.types.IValidator): tendermint.types.Validator; + + /** + * Encodes the specified Validator message. Does not implicitly {@link tendermint.types.Validator.verify|verify} messages. + * @param m Validator message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: tendermint.types.IValidator, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Validator message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns Validator + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): tendermint.types.Validator; + } + + /** Properties of a SimpleValidator. */ + interface ISimpleValidator { + /** SimpleValidator pubKey */ + pubKey?: tendermint.crypto.IPublicKey | null; + + /** SimpleValidator votingPower */ + votingPower?: Long | null; + } + + /** Represents a SimpleValidator. */ + class SimpleValidator implements ISimpleValidator { + /** + * Constructs a new SimpleValidator. + * @param [p] Properties to set + */ + constructor(p?: tendermint.types.ISimpleValidator); + + /** SimpleValidator pubKey. */ + public pubKey?: tendermint.crypto.IPublicKey | null; + + /** SimpleValidator votingPower. */ + public votingPower: Long; + + /** + * Creates a new SimpleValidator instance using the specified properties. + * @param [properties] Properties to set + * @returns SimpleValidator instance + */ + public static create(properties?: tendermint.types.ISimpleValidator): tendermint.types.SimpleValidator; + + /** + * Encodes the specified SimpleValidator message. Does not implicitly {@link tendermint.types.SimpleValidator.verify|verify} messages. + * @param m SimpleValidator message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: tendermint.types.ISimpleValidator, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SimpleValidator message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns SimpleValidator + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): tendermint.types.SimpleValidator; + } + } + + /** Namespace version. */ + namespace version { + /** Properties of an App. */ + interface IApp { + /** App protocol */ + protocol?: Long | null; + + /** App software */ + software?: string | null; + } + + /** Represents an App. */ + class App implements IApp { + /** + * Constructs a new App. + * @param [p] Properties to set + */ + constructor(p?: tendermint.version.IApp); + + /** App protocol. */ + public protocol: Long; + + /** App software. */ + public software: string; + + /** + * Creates a new App instance using the specified properties. + * @param [properties] Properties to set + * @returns App instance + */ + public static create(properties?: tendermint.version.IApp): tendermint.version.App; + + /** + * Encodes the specified App message. Does not implicitly {@link tendermint.version.App.verify|verify} messages. + * @param m App message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: tendermint.version.IApp, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an App message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns App + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): tendermint.version.App; + } + + /** Properties of a Consensus. */ + interface IConsensus { + /** Consensus block */ + block?: Long | null; + + /** Consensus app */ + app?: Long | null; + } + + /** Represents a Consensus. */ + class Consensus implements IConsensus { + /** + * Constructs a new Consensus. + * @param [p] Properties to set + */ + constructor(p?: tendermint.version.IConsensus); + + /** Consensus block. */ + public block: Long; + + /** Consensus app. */ + public app: Long; + + /** + * Creates a new Consensus instance using the specified properties. + * @param [properties] Properties to set + * @returns Consensus instance + */ + public static create(properties?: tendermint.version.IConsensus): tendermint.version.Consensus; + + /** + * Encodes the specified Consensus message. Does not implicitly {@link tendermint.version.Consensus.verify|verify} messages. + * @param m Consensus message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: tendermint.version.IConsensus, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Consensus message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns Consensus + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): tendermint.version.Consensus; + } + } } diff --git a/packages/stargate/src/codec/generated/codecimpl.js b/packages/stargate/src/codec/generated/codecimpl.js index 8316d31d..8674615a 100644 --- a/packages/stargate/src/codec/generated/codecimpl.js +++ b/packages/stargate/src/codec/generated/codecimpl.js @@ -1201,6 +1201,1267 @@ exports.cosmos = $root.cosmos = (() => { })(); return crypto; })(); + cosmos.staking = (function () { + const staking = {}; + staking.v1beta1 = (function () { + const v1beta1 = {}; + v1beta1.HistoricalInfo = (function () { + function HistoricalInfo(p) { + this.valset = []; + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + HistoricalInfo.prototype.header = null; + HistoricalInfo.prototype.valset = $util.emptyArray; + HistoricalInfo.create = function create(properties) { + return new HistoricalInfo(properties); + }; + HistoricalInfo.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.header != null && Object.hasOwnProperty.call(m, "header")) + $root.tendermint.types.Header.encode(m.header, w.uint32(10).fork()).ldelim(); + if (m.valset != null && m.valset.length) { + for (var i = 0; i < m.valset.length; ++i) + $root.cosmos.staking.v1beta1.Validator.encode(m.valset[i], w.uint32(18).fork()).ldelim(); + } + return w; + }; + HistoricalInfo.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.cosmos.staking.v1beta1.HistoricalInfo(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + m.header = $root.tendermint.types.Header.decode(r, r.uint32()); + break; + case 2: + if (!(m.valset && m.valset.length)) m.valset = []; + m.valset.push($root.cosmos.staking.v1beta1.Validator.decode(r, r.uint32())); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return HistoricalInfo; + })(); + v1beta1.CommissionRates = (function () { + function CommissionRates(p) { + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + CommissionRates.prototype.rate = ""; + CommissionRates.prototype.maxRate = ""; + CommissionRates.prototype.maxChangeRate = ""; + CommissionRates.create = function create(properties) { + return new CommissionRates(properties); + }; + CommissionRates.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.rate != null && Object.hasOwnProperty.call(m, "rate")) w.uint32(10).string(m.rate); + if (m.maxRate != null && Object.hasOwnProperty.call(m, "maxRate")) w.uint32(18).string(m.maxRate); + if (m.maxChangeRate != null && Object.hasOwnProperty.call(m, "maxChangeRate")) + w.uint32(26).string(m.maxChangeRate); + return w; + }; + CommissionRates.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.cosmos.staking.v1beta1.CommissionRates(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + m.rate = r.string(); + break; + case 2: + m.maxRate = r.string(); + break; + case 3: + m.maxChangeRate = r.string(); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return CommissionRates; + })(); + v1beta1.Commission = (function () { + function Commission(p) { + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + Commission.prototype.commissionRates = null; + Commission.prototype.updateTime = null; + Commission.create = function create(properties) { + return new Commission(properties); + }; + Commission.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.commissionRates != null && Object.hasOwnProperty.call(m, "commissionRates")) + $root.cosmos.staking.v1beta1.CommissionRates.encode( + m.commissionRates, + w.uint32(10).fork(), + ).ldelim(); + if (m.updateTime != null && Object.hasOwnProperty.call(m, "updateTime")) + $root.google.protobuf.Timestamp.encode(m.updateTime, w.uint32(18).fork()).ldelim(); + return w; + }; + Commission.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.cosmos.staking.v1beta1.Commission(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + m.commissionRates = $root.cosmos.staking.v1beta1.CommissionRates.decode(r, r.uint32()); + break; + case 2: + m.updateTime = $root.google.protobuf.Timestamp.decode(r, r.uint32()); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return Commission; + })(); + v1beta1.Description = (function () { + function Description(p) { + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + Description.prototype.moniker = ""; + Description.prototype.identity = ""; + Description.prototype.website = ""; + Description.prototype.securityContact = ""; + Description.prototype.details = ""; + Description.create = function create(properties) { + return new Description(properties); + }; + Description.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.moniker != null && Object.hasOwnProperty.call(m, "moniker")) w.uint32(10).string(m.moniker); + if (m.identity != null && Object.hasOwnProperty.call(m, "identity")) + w.uint32(18).string(m.identity); + if (m.website != null && Object.hasOwnProperty.call(m, "website")) w.uint32(26).string(m.website); + if (m.securityContact != null && Object.hasOwnProperty.call(m, "securityContact")) + w.uint32(34).string(m.securityContact); + if (m.details != null && Object.hasOwnProperty.call(m, "details")) w.uint32(42).string(m.details); + return w; + }; + Description.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.cosmos.staking.v1beta1.Description(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + m.moniker = r.string(); + break; + case 2: + m.identity = r.string(); + break; + case 3: + m.website = r.string(); + break; + case 4: + m.securityContact = r.string(); + break; + case 5: + m.details = r.string(); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return Description; + })(); + v1beta1.Validator = (function () { + function Validator(p) { + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + Validator.prototype.operatorAddress = ""; + Validator.prototype.consensusPubkey = ""; + Validator.prototype.jailed = false; + Validator.prototype.status = 0; + Validator.prototype.tokens = ""; + Validator.prototype.delegatorShares = ""; + Validator.prototype.description = null; + Validator.prototype.unbondingHeight = $util.Long ? $util.Long.fromBits(0, 0, false) : 0; + Validator.prototype.unbondingTime = null; + Validator.prototype.commission = null; + Validator.prototype.minSelfDelegation = ""; + Validator.create = function create(properties) { + return new Validator(properties); + }; + Validator.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.operatorAddress != null && Object.hasOwnProperty.call(m, "operatorAddress")) + w.uint32(10).string(m.operatorAddress); + if (m.consensusPubkey != null && Object.hasOwnProperty.call(m, "consensusPubkey")) + w.uint32(18).string(m.consensusPubkey); + if (m.jailed != null && Object.hasOwnProperty.call(m, "jailed")) w.uint32(24).bool(m.jailed); + if (m.status != null && Object.hasOwnProperty.call(m, "status")) w.uint32(32).int32(m.status); + if (m.tokens != null && Object.hasOwnProperty.call(m, "tokens")) w.uint32(42).string(m.tokens); + if (m.delegatorShares != null && Object.hasOwnProperty.call(m, "delegatorShares")) + w.uint32(50).string(m.delegatorShares); + if (m.description != null && Object.hasOwnProperty.call(m, "description")) + $root.cosmos.staking.v1beta1.Description.encode(m.description, w.uint32(58).fork()).ldelim(); + if (m.unbondingHeight != null && Object.hasOwnProperty.call(m, "unbondingHeight")) + w.uint32(64).int64(m.unbondingHeight); + if (m.unbondingTime != null && Object.hasOwnProperty.call(m, "unbondingTime")) + $root.google.protobuf.Timestamp.encode(m.unbondingTime, w.uint32(74).fork()).ldelim(); + if (m.commission != null && Object.hasOwnProperty.call(m, "commission")) + $root.cosmos.staking.v1beta1.Commission.encode(m.commission, w.uint32(82).fork()).ldelim(); + if (m.minSelfDelegation != null && Object.hasOwnProperty.call(m, "minSelfDelegation")) + w.uint32(90).string(m.minSelfDelegation); + return w; + }; + Validator.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.cosmos.staking.v1beta1.Validator(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + m.operatorAddress = r.string(); + break; + case 2: + m.consensusPubkey = r.string(); + break; + case 3: + m.jailed = r.bool(); + break; + case 4: + m.status = r.int32(); + break; + case 5: + m.tokens = r.string(); + break; + case 6: + m.delegatorShares = r.string(); + break; + case 7: + m.description = $root.cosmos.staking.v1beta1.Description.decode(r, r.uint32()); + break; + case 8: + m.unbondingHeight = r.int64(); + break; + case 9: + m.unbondingTime = $root.google.protobuf.Timestamp.decode(r, r.uint32()); + break; + case 10: + m.commission = $root.cosmos.staking.v1beta1.Commission.decode(r, r.uint32()); + break; + case 11: + m.minSelfDelegation = r.string(); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return Validator; + })(); + v1beta1.ValAddresses = (function () { + function ValAddresses(p) { + this.addresses = []; + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + ValAddresses.prototype.addresses = $util.emptyArray; + ValAddresses.create = function create(properties) { + return new ValAddresses(properties); + }; + ValAddresses.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.addresses != null && m.addresses.length) { + for (var i = 0; i < m.addresses.length; ++i) w.uint32(10).string(m.addresses[i]); + } + return w; + }; + ValAddresses.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.cosmos.staking.v1beta1.ValAddresses(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + if (!(m.addresses && m.addresses.length)) m.addresses = []; + m.addresses.push(r.string()); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return ValAddresses; + })(); + v1beta1.DVPair = (function () { + function DVPair(p) { + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + DVPair.prototype.delegatorAddress = ""; + DVPair.prototype.validatorAddress = ""; + DVPair.create = function create(properties) { + return new DVPair(properties); + }; + DVPair.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.delegatorAddress != null && Object.hasOwnProperty.call(m, "delegatorAddress")) + w.uint32(10).string(m.delegatorAddress); + if (m.validatorAddress != null && Object.hasOwnProperty.call(m, "validatorAddress")) + w.uint32(18).string(m.validatorAddress); + return w; + }; + DVPair.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.cosmos.staking.v1beta1.DVPair(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + m.delegatorAddress = r.string(); + break; + case 2: + m.validatorAddress = r.string(); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return DVPair; + })(); + v1beta1.DVPairs = (function () { + function DVPairs(p) { + this.pairs = []; + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + DVPairs.prototype.pairs = $util.emptyArray; + DVPairs.create = function create(properties) { + return new DVPairs(properties); + }; + DVPairs.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.pairs != null && m.pairs.length) { + for (var i = 0; i < m.pairs.length; ++i) + $root.cosmos.staking.v1beta1.DVPair.encode(m.pairs[i], w.uint32(10).fork()).ldelim(); + } + return w; + }; + DVPairs.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.cosmos.staking.v1beta1.DVPairs(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + if (!(m.pairs && m.pairs.length)) m.pairs = []; + m.pairs.push($root.cosmos.staking.v1beta1.DVPair.decode(r, r.uint32())); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return DVPairs; + })(); + v1beta1.DVVTriplet = (function () { + function DVVTriplet(p) { + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + DVVTriplet.prototype.delegatorAddress = ""; + DVVTriplet.prototype.validatorSrcAddress = ""; + DVVTriplet.prototype.validatorDstAddress = ""; + DVVTriplet.create = function create(properties) { + return new DVVTriplet(properties); + }; + DVVTriplet.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.delegatorAddress != null && Object.hasOwnProperty.call(m, "delegatorAddress")) + w.uint32(10).string(m.delegatorAddress); + if (m.validatorSrcAddress != null && Object.hasOwnProperty.call(m, "validatorSrcAddress")) + w.uint32(18).string(m.validatorSrcAddress); + if (m.validatorDstAddress != null && Object.hasOwnProperty.call(m, "validatorDstAddress")) + w.uint32(26).string(m.validatorDstAddress); + return w; + }; + DVVTriplet.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.cosmos.staking.v1beta1.DVVTriplet(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + m.delegatorAddress = r.string(); + break; + case 2: + m.validatorSrcAddress = r.string(); + break; + case 3: + m.validatorDstAddress = r.string(); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return DVVTriplet; + })(); + v1beta1.DVVTriplets = (function () { + function DVVTriplets(p) { + this.triplets = []; + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + DVVTriplets.prototype.triplets = $util.emptyArray; + DVVTriplets.create = function create(properties) { + return new DVVTriplets(properties); + }; + DVVTriplets.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.triplets != null && m.triplets.length) { + for (var i = 0; i < m.triplets.length; ++i) + $root.cosmos.staking.v1beta1.DVVTriplet.encode(m.triplets[i], w.uint32(10).fork()).ldelim(); + } + return w; + }; + DVVTriplets.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.cosmos.staking.v1beta1.DVVTriplets(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + if (!(m.triplets && m.triplets.length)) m.triplets = []; + m.triplets.push($root.cosmos.staking.v1beta1.DVVTriplet.decode(r, r.uint32())); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return DVVTriplets; + })(); + v1beta1.Delegation = (function () { + function Delegation(p) { + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + Delegation.prototype.delegatorAddress = ""; + Delegation.prototype.validatorAddress = ""; + Delegation.prototype.shares = ""; + Delegation.create = function create(properties) { + return new Delegation(properties); + }; + Delegation.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.delegatorAddress != null && Object.hasOwnProperty.call(m, "delegatorAddress")) + w.uint32(10).string(m.delegatorAddress); + if (m.validatorAddress != null && Object.hasOwnProperty.call(m, "validatorAddress")) + w.uint32(18).string(m.validatorAddress); + if (m.shares != null && Object.hasOwnProperty.call(m, "shares")) w.uint32(26).string(m.shares); + return w; + }; + Delegation.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.cosmos.staking.v1beta1.Delegation(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + m.delegatorAddress = r.string(); + break; + case 2: + m.validatorAddress = r.string(); + break; + case 3: + m.shares = r.string(); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return Delegation; + })(); + v1beta1.UnbondingDelegation = (function () { + function UnbondingDelegation(p) { + this.entries = []; + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + UnbondingDelegation.prototype.delegatorAddress = ""; + UnbondingDelegation.prototype.validatorAddress = ""; + UnbondingDelegation.prototype.entries = $util.emptyArray; + UnbondingDelegation.create = function create(properties) { + return new UnbondingDelegation(properties); + }; + UnbondingDelegation.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.delegatorAddress != null && Object.hasOwnProperty.call(m, "delegatorAddress")) + w.uint32(10).string(m.delegatorAddress); + if (m.validatorAddress != null && Object.hasOwnProperty.call(m, "validatorAddress")) + w.uint32(18).string(m.validatorAddress); + if (m.entries != null && m.entries.length) { + for (var i = 0; i < m.entries.length; ++i) + $root.cosmos.staking.v1beta1.UnbondingDelegationEntry.encode( + m.entries[i], + w.uint32(26).fork(), + ).ldelim(); + } + return w; + }; + UnbondingDelegation.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.cosmos.staking.v1beta1.UnbondingDelegation(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + m.delegatorAddress = r.string(); + break; + case 2: + m.validatorAddress = r.string(); + break; + case 3: + if (!(m.entries && m.entries.length)) m.entries = []; + m.entries.push($root.cosmos.staking.v1beta1.UnbondingDelegationEntry.decode(r, r.uint32())); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return UnbondingDelegation; + })(); + v1beta1.UnbondingDelegationEntry = (function () { + function UnbondingDelegationEntry(p) { + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + UnbondingDelegationEntry.prototype.creationHeight = $util.Long ? $util.Long.fromBits(0, 0, false) : 0; + UnbondingDelegationEntry.prototype.completionTime = null; + UnbondingDelegationEntry.prototype.initialBalance = ""; + UnbondingDelegationEntry.prototype.balance = ""; + UnbondingDelegationEntry.create = function create(properties) { + return new UnbondingDelegationEntry(properties); + }; + UnbondingDelegationEntry.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.creationHeight != null && Object.hasOwnProperty.call(m, "creationHeight")) + w.uint32(8).int64(m.creationHeight); + if (m.completionTime != null && Object.hasOwnProperty.call(m, "completionTime")) + $root.google.protobuf.Timestamp.encode(m.completionTime, w.uint32(18).fork()).ldelim(); + if (m.initialBalance != null && Object.hasOwnProperty.call(m, "initialBalance")) + w.uint32(26).string(m.initialBalance); + if (m.balance != null && Object.hasOwnProperty.call(m, "balance")) w.uint32(34).string(m.balance); + return w; + }; + UnbondingDelegationEntry.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.cosmos.staking.v1beta1.UnbondingDelegationEntry(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + m.creationHeight = r.int64(); + break; + case 2: + m.completionTime = $root.google.protobuf.Timestamp.decode(r, r.uint32()); + break; + case 3: + m.initialBalance = r.string(); + break; + case 4: + m.balance = r.string(); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return UnbondingDelegationEntry; + })(); + v1beta1.RedelegationEntry = (function () { + function RedelegationEntry(p) { + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + RedelegationEntry.prototype.creationHeight = $util.Long ? $util.Long.fromBits(0, 0, false) : 0; + RedelegationEntry.prototype.completionTime = null; + RedelegationEntry.prototype.initialBalance = ""; + RedelegationEntry.prototype.sharesDst = ""; + RedelegationEntry.create = function create(properties) { + return new RedelegationEntry(properties); + }; + RedelegationEntry.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.creationHeight != null && Object.hasOwnProperty.call(m, "creationHeight")) + w.uint32(8).int64(m.creationHeight); + if (m.completionTime != null && Object.hasOwnProperty.call(m, "completionTime")) + $root.google.protobuf.Timestamp.encode(m.completionTime, w.uint32(18).fork()).ldelim(); + if (m.initialBalance != null && Object.hasOwnProperty.call(m, "initialBalance")) + w.uint32(26).string(m.initialBalance); + if (m.sharesDst != null && Object.hasOwnProperty.call(m, "sharesDst")) + w.uint32(34).string(m.sharesDst); + return w; + }; + RedelegationEntry.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.cosmos.staking.v1beta1.RedelegationEntry(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + m.creationHeight = r.int64(); + break; + case 2: + m.completionTime = $root.google.protobuf.Timestamp.decode(r, r.uint32()); + break; + case 3: + m.initialBalance = r.string(); + break; + case 4: + m.sharesDst = r.string(); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return RedelegationEntry; + })(); + v1beta1.Redelegation = (function () { + function Redelegation(p) { + this.entries = []; + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + Redelegation.prototype.delegatorAddress = ""; + Redelegation.prototype.validatorSrcAddress = ""; + Redelegation.prototype.validatorDstAddress = ""; + Redelegation.prototype.entries = $util.emptyArray; + Redelegation.create = function create(properties) { + return new Redelegation(properties); + }; + Redelegation.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.delegatorAddress != null && Object.hasOwnProperty.call(m, "delegatorAddress")) + w.uint32(10).string(m.delegatorAddress); + if (m.validatorSrcAddress != null && Object.hasOwnProperty.call(m, "validatorSrcAddress")) + w.uint32(18).string(m.validatorSrcAddress); + if (m.validatorDstAddress != null && Object.hasOwnProperty.call(m, "validatorDstAddress")) + w.uint32(26).string(m.validatorDstAddress); + if (m.entries != null && m.entries.length) { + for (var i = 0; i < m.entries.length; ++i) + $root.cosmos.staking.v1beta1.RedelegationEntry.encode( + m.entries[i], + w.uint32(34).fork(), + ).ldelim(); + } + return w; + }; + Redelegation.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.cosmos.staking.v1beta1.Redelegation(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + m.delegatorAddress = r.string(); + break; + case 2: + m.validatorSrcAddress = r.string(); + break; + case 3: + m.validatorDstAddress = r.string(); + break; + case 4: + if (!(m.entries && m.entries.length)) m.entries = []; + m.entries.push($root.cosmos.staking.v1beta1.RedelegationEntry.decode(r, r.uint32())); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return Redelegation; + })(); + v1beta1.Params = (function () { + function Params(p) { + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + Params.prototype.unbondingTime = null; + Params.prototype.maxValidators = 0; + Params.prototype.maxEntries = 0; + Params.prototype.historicalEntries = 0; + Params.prototype.bondDenom = ""; + Params.create = function create(properties) { + return new Params(properties); + }; + Params.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.unbondingTime != null && Object.hasOwnProperty.call(m, "unbondingTime")) + $root.google.protobuf.Duration.encode(m.unbondingTime, w.uint32(10).fork()).ldelim(); + if (m.maxValidators != null && Object.hasOwnProperty.call(m, "maxValidators")) + w.uint32(16).uint32(m.maxValidators); + if (m.maxEntries != null && Object.hasOwnProperty.call(m, "maxEntries")) + w.uint32(24).uint32(m.maxEntries); + if (m.historicalEntries != null && Object.hasOwnProperty.call(m, "historicalEntries")) + w.uint32(32).uint32(m.historicalEntries); + if (m.bondDenom != null && Object.hasOwnProperty.call(m, "bondDenom")) + w.uint32(42).string(m.bondDenom); + return w; + }; + Params.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.cosmos.staking.v1beta1.Params(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + m.unbondingTime = $root.google.protobuf.Duration.decode(r, r.uint32()); + break; + case 2: + m.maxValidators = r.uint32(); + break; + case 3: + m.maxEntries = r.uint32(); + break; + case 4: + m.historicalEntries = r.uint32(); + break; + case 5: + m.bondDenom = r.string(); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return Params; + })(); + v1beta1.DelegationResponse = (function () { + function DelegationResponse(p) { + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + DelegationResponse.prototype.delegation = null; + DelegationResponse.prototype.balance = null; + DelegationResponse.create = function create(properties) { + return new DelegationResponse(properties); + }; + DelegationResponse.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.delegation != null && Object.hasOwnProperty.call(m, "delegation")) + $root.cosmos.staking.v1beta1.Delegation.encode(m.delegation, w.uint32(10).fork()).ldelim(); + if (m.balance != null && Object.hasOwnProperty.call(m, "balance")) + $root.cosmos.base.v1beta1.Coin.encode(m.balance, w.uint32(18).fork()).ldelim(); + return w; + }; + DelegationResponse.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.cosmos.staking.v1beta1.DelegationResponse(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + m.delegation = $root.cosmos.staking.v1beta1.Delegation.decode(r, r.uint32()); + break; + case 2: + m.balance = $root.cosmos.base.v1beta1.Coin.decode(r, r.uint32()); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return DelegationResponse; + })(); + v1beta1.RedelegationEntryResponse = (function () { + function RedelegationEntryResponse(p) { + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + RedelegationEntryResponse.prototype.redelegationEntry = null; + RedelegationEntryResponse.prototype.balance = ""; + RedelegationEntryResponse.create = function create(properties) { + return new RedelegationEntryResponse(properties); + }; + RedelegationEntryResponse.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.redelegationEntry != null && Object.hasOwnProperty.call(m, "redelegationEntry")) + $root.cosmos.staking.v1beta1.RedelegationEntry.encode( + m.redelegationEntry, + w.uint32(10).fork(), + ).ldelim(); + if (m.balance != null && Object.hasOwnProperty.call(m, "balance")) w.uint32(34).string(m.balance); + return w; + }; + RedelegationEntryResponse.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.cosmos.staking.v1beta1.RedelegationEntryResponse(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + m.redelegationEntry = $root.cosmos.staking.v1beta1.RedelegationEntry.decode(r, r.uint32()); + break; + case 4: + m.balance = r.string(); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return RedelegationEntryResponse; + })(); + v1beta1.RedelegationResponse = (function () { + function RedelegationResponse(p) { + this.entries = []; + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + RedelegationResponse.prototype.redelegation = null; + RedelegationResponse.prototype.entries = $util.emptyArray; + RedelegationResponse.create = function create(properties) { + return new RedelegationResponse(properties); + }; + RedelegationResponse.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.redelegation != null && Object.hasOwnProperty.call(m, "redelegation")) + $root.cosmos.staking.v1beta1.Redelegation.encode(m.redelegation, w.uint32(10).fork()).ldelim(); + if (m.entries != null && m.entries.length) { + for (var i = 0; i < m.entries.length; ++i) + $root.cosmos.staking.v1beta1.RedelegationEntryResponse.encode( + m.entries[i], + w.uint32(18).fork(), + ).ldelim(); + } + return w; + }; + RedelegationResponse.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.cosmos.staking.v1beta1.RedelegationResponse(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + m.redelegation = $root.cosmos.staking.v1beta1.Redelegation.decode(r, r.uint32()); + break; + case 2: + if (!(m.entries && m.entries.length)) m.entries = []; + m.entries.push($root.cosmos.staking.v1beta1.RedelegationEntryResponse.decode(r, r.uint32())); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return RedelegationResponse; + })(); + v1beta1.Pool = (function () { + function Pool(p) { + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + Pool.prototype.notBondedTokens = ""; + Pool.prototype.bondedTokens = ""; + Pool.create = function create(properties) { + return new Pool(properties); + }; + Pool.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.notBondedTokens != null && Object.hasOwnProperty.call(m, "notBondedTokens")) + w.uint32(10).string(m.notBondedTokens); + if (m.bondedTokens != null && Object.hasOwnProperty.call(m, "bondedTokens")) + w.uint32(18).string(m.bondedTokens); + return w; + }; + Pool.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.cosmos.staking.v1beta1.Pool(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + m.notBondedTokens = r.string(); + break; + case 2: + m.bondedTokens = r.string(); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return Pool; + })(); + v1beta1.MsgCreateValidator = (function () { + function MsgCreateValidator(p) { + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + MsgCreateValidator.prototype.description = null; + MsgCreateValidator.prototype.commission = null; + MsgCreateValidator.prototype.minSelfDelegation = ""; + MsgCreateValidator.prototype.delegatorAddress = ""; + MsgCreateValidator.prototype.validatorAddress = ""; + MsgCreateValidator.prototype.pubkey = ""; + MsgCreateValidator.prototype.value = null; + MsgCreateValidator.create = function create(properties) { + return new MsgCreateValidator(properties); + }; + MsgCreateValidator.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.description != null && Object.hasOwnProperty.call(m, "description")) + $root.cosmos.staking.v1beta1.Description.encode(m.description, w.uint32(10).fork()).ldelim(); + if (m.commission != null && Object.hasOwnProperty.call(m, "commission")) + $root.cosmos.staking.v1beta1.CommissionRates.encode(m.commission, w.uint32(18).fork()).ldelim(); + if (m.minSelfDelegation != null && Object.hasOwnProperty.call(m, "minSelfDelegation")) + w.uint32(26).string(m.minSelfDelegation); + if (m.delegatorAddress != null && Object.hasOwnProperty.call(m, "delegatorAddress")) + w.uint32(34).string(m.delegatorAddress); + if (m.validatorAddress != null && Object.hasOwnProperty.call(m, "validatorAddress")) + w.uint32(42).string(m.validatorAddress); + if (m.pubkey != null && Object.hasOwnProperty.call(m, "pubkey")) w.uint32(50).string(m.pubkey); + if (m.value != null && Object.hasOwnProperty.call(m, "value")) + $root.cosmos.base.v1beta1.Coin.encode(m.value, w.uint32(58).fork()).ldelim(); + return w; + }; + MsgCreateValidator.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.cosmos.staking.v1beta1.MsgCreateValidator(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + m.description = $root.cosmos.staking.v1beta1.Description.decode(r, r.uint32()); + break; + case 2: + m.commission = $root.cosmos.staking.v1beta1.CommissionRates.decode(r, r.uint32()); + break; + case 3: + m.minSelfDelegation = r.string(); + break; + case 4: + m.delegatorAddress = r.string(); + break; + case 5: + m.validatorAddress = r.string(); + break; + case 6: + m.pubkey = r.string(); + break; + case 7: + m.value = $root.cosmos.base.v1beta1.Coin.decode(r, r.uint32()); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return MsgCreateValidator; + })(); + v1beta1.MsgEditValidator = (function () { + function MsgEditValidator(p) { + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + MsgEditValidator.prototype.description = null; + MsgEditValidator.prototype.validatorAddress = ""; + MsgEditValidator.prototype.commissionRate = ""; + MsgEditValidator.prototype.minSelfDelegation = ""; + MsgEditValidator.create = function create(properties) { + return new MsgEditValidator(properties); + }; + MsgEditValidator.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.description != null && Object.hasOwnProperty.call(m, "description")) + $root.cosmos.staking.v1beta1.Description.encode(m.description, w.uint32(10).fork()).ldelim(); + if (m.validatorAddress != null && Object.hasOwnProperty.call(m, "validatorAddress")) + w.uint32(18).string(m.validatorAddress); + if (m.commissionRate != null && Object.hasOwnProperty.call(m, "commissionRate")) + w.uint32(26).string(m.commissionRate); + if (m.minSelfDelegation != null && Object.hasOwnProperty.call(m, "minSelfDelegation")) + w.uint32(34).string(m.minSelfDelegation); + return w; + }; + MsgEditValidator.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.cosmos.staking.v1beta1.MsgEditValidator(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + m.description = $root.cosmos.staking.v1beta1.Description.decode(r, r.uint32()); + break; + case 2: + m.validatorAddress = r.string(); + break; + case 3: + m.commissionRate = r.string(); + break; + case 4: + m.minSelfDelegation = r.string(); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return MsgEditValidator; + })(); + v1beta1.MsgDelegate = (function () { + function MsgDelegate(p) { + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + MsgDelegate.prototype.delegatorAddress = ""; + MsgDelegate.prototype.validatorAddress = ""; + MsgDelegate.prototype.amount = null; + MsgDelegate.create = function create(properties) { + return new MsgDelegate(properties); + }; + MsgDelegate.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.delegatorAddress != null && Object.hasOwnProperty.call(m, "delegatorAddress")) + w.uint32(10).string(m.delegatorAddress); + if (m.validatorAddress != null && Object.hasOwnProperty.call(m, "validatorAddress")) + w.uint32(18).string(m.validatorAddress); + if (m.amount != null && Object.hasOwnProperty.call(m, "amount")) + $root.cosmos.base.v1beta1.Coin.encode(m.amount, w.uint32(26).fork()).ldelim(); + return w; + }; + MsgDelegate.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.cosmos.staking.v1beta1.MsgDelegate(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + m.delegatorAddress = r.string(); + break; + case 2: + m.validatorAddress = r.string(); + break; + case 3: + m.amount = $root.cosmos.base.v1beta1.Coin.decode(r, r.uint32()); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return MsgDelegate; + })(); + v1beta1.MsgBeginRedelegate = (function () { + function MsgBeginRedelegate(p) { + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + MsgBeginRedelegate.prototype.delegatorAddress = ""; + MsgBeginRedelegate.prototype.validatorSrcAddress = ""; + MsgBeginRedelegate.prototype.validatorDstAddress = ""; + MsgBeginRedelegate.prototype.amount = null; + MsgBeginRedelegate.create = function create(properties) { + return new MsgBeginRedelegate(properties); + }; + MsgBeginRedelegate.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.delegatorAddress != null && Object.hasOwnProperty.call(m, "delegatorAddress")) + w.uint32(10).string(m.delegatorAddress); + if (m.validatorSrcAddress != null && Object.hasOwnProperty.call(m, "validatorSrcAddress")) + w.uint32(18).string(m.validatorSrcAddress); + if (m.validatorDstAddress != null && Object.hasOwnProperty.call(m, "validatorDstAddress")) + w.uint32(26).string(m.validatorDstAddress); + if (m.amount != null && Object.hasOwnProperty.call(m, "amount")) + $root.cosmos.base.v1beta1.Coin.encode(m.amount, w.uint32(34).fork()).ldelim(); + return w; + }; + MsgBeginRedelegate.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.cosmos.staking.v1beta1.MsgBeginRedelegate(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + m.delegatorAddress = r.string(); + break; + case 2: + m.validatorSrcAddress = r.string(); + break; + case 3: + m.validatorDstAddress = r.string(); + break; + case 4: + m.amount = $root.cosmos.base.v1beta1.Coin.decode(r, r.uint32()); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return MsgBeginRedelegate; + })(); + v1beta1.MsgUndelegate = (function () { + function MsgUndelegate(p) { + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + MsgUndelegate.prototype.delegatorAddress = ""; + MsgUndelegate.prototype.validatorAddress = ""; + MsgUndelegate.prototype.amount = null; + MsgUndelegate.create = function create(properties) { + return new MsgUndelegate(properties); + }; + MsgUndelegate.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.delegatorAddress != null && Object.hasOwnProperty.call(m, "delegatorAddress")) + w.uint32(10).string(m.delegatorAddress); + if (m.validatorAddress != null && Object.hasOwnProperty.call(m, "validatorAddress")) + w.uint32(18).string(m.validatorAddress); + if (m.amount != null && Object.hasOwnProperty.call(m, "amount")) + $root.cosmos.base.v1beta1.Coin.encode(m.amount, w.uint32(26).fork()).ldelim(); + return w; + }; + MsgUndelegate.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.cosmos.staking.v1beta1.MsgUndelegate(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + m.delegatorAddress = r.string(); + break; + case 2: + m.validatorAddress = r.string(); + break; + case 3: + m.amount = $root.cosmos.base.v1beta1.Coin.decode(r, r.uint32()); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return MsgUndelegate; + })(); + return v1beta1; + })(); + return staking; + })(); cosmos.tx = (function () { const tx = {}; tx.signing = (function () { @@ -3631,6 +4892,84 @@ exports.google = $root.google = (() => { })(); return GeneratedCodeInfo; })(); + protobuf.Timestamp = (function () { + function Timestamp(p) { + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + Timestamp.prototype.seconds = $util.Long ? $util.Long.fromBits(0, 0, false) : 0; + Timestamp.prototype.nanos = 0; + Timestamp.create = function create(properties) { + return new Timestamp(properties); + }; + Timestamp.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.seconds != null && Object.hasOwnProperty.call(m, "seconds")) w.uint32(8).int64(m.seconds); + if (m.nanos != null && Object.hasOwnProperty.call(m, "nanos")) w.uint32(16).int32(m.nanos); + return w; + }; + Timestamp.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.google.protobuf.Timestamp(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + m.seconds = r.int64(); + break; + case 2: + m.nanos = r.int32(); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return Timestamp; + })(); + protobuf.Duration = (function () { + function Duration(p) { + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + Duration.prototype.seconds = $util.Long ? $util.Long.fromBits(0, 0, false) : 0; + Duration.prototype.nanos = 0; + Duration.create = function create(properties) { + return new Duration(properties); + }; + Duration.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.seconds != null && Object.hasOwnProperty.call(m, "seconds")) w.uint32(8).int64(m.seconds); + if (m.nanos != null && Object.hasOwnProperty.call(m, "nanos")) w.uint32(16).int32(m.nanos); + return w; + }; + Duration.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.google.protobuf.Duration(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + m.seconds = r.int64(); + break; + case 2: + m.nanos = r.int32(); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return Duration; + })(); return protobuf; })(); google.api = (function () { @@ -7831,6 +9170,45 @@ exports.tendermint = $root.tendermint = (() => { const tendermint = {}; tendermint.crypto = (function () { const crypto = {}; + crypto.PublicKey = (function () { + function PublicKey(p) { + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + PublicKey.prototype.ed25519 = $util.newBuffer([]); + let $oneOfFields; + Object.defineProperty(PublicKey.prototype, "sum", { + get: $util.oneOfGetter(($oneOfFields = ["ed25519"])), + set: $util.oneOfSetter($oneOfFields), + }); + PublicKey.create = function create(properties) { + return new PublicKey(properties); + }; + PublicKey.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.ed25519 != null && Object.hasOwnProperty.call(m, "ed25519")) w.uint32(10).bytes(m.ed25519); + return w; + }; + PublicKey.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.tendermint.crypto.PublicKey(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + m.ed25519 = r.bytes(); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return PublicKey; + })(); crypto.Proof = (function () { function Proof(p) { this.aunts = []; @@ -8053,6 +9431,1025 @@ exports.tendermint = $root.tendermint = (() => { })(); return crypto; })(); + tendermint.libs = (function () { + const libs = {}; + libs.bits = (function () { + const bits = {}; + bits.BitArray = (function () { + function BitArray(p) { + this.elems = []; + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + BitArray.prototype.bits = $util.Long ? $util.Long.fromBits(0, 0, false) : 0; + BitArray.prototype.elems = $util.emptyArray; + BitArray.create = function create(properties) { + return new BitArray(properties); + }; + BitArray.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.bits != null && Object.hasOwnProperty.call(m, "bits")) w.uint32(8).int64(m.bits); + if (m.elems != null && m.elems.length) { + w.uint32(18).fork(); + for (var i = 0; i < m.elems.length; ++i) w.uint64(m.elems[i]); + w.ldelim(); + } + return w; + }; + BitArray.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.tendermint.libs.bits.BitArray(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + m.bits = r.int64(); + break; + case 2: + if (!(m.elems && m.elems.length)) m.elems = []; + if ((t & 7) === 2) { + var c2 = r.uint32() + r.pos; + while (r.pos < c2) m.elems.push(r.uint64()); + } else m.elems.push(r.uint64()); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return BitArray; + })(); + return bits; + })(); + return libs; + })(); + tendermint.types = (function () { + const types = {}; + 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; + })(); + 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 () { + function PartSetHeader(p) { + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + PartSetHeader.prototype.total = 0; + PartSetHeader.prototype.hash = $util.newBuffer([]); + PartSetHeader.create = function create(properties) { + return new PartSetHeader(properties); + }; + PartSetHeader.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.total != null && Object.hasOwnProperty.call(m, "total")) w.uint32(8).uint32(m.total); + if (m.hash != null && Object.hasOwnProperty.call(m, "hash")) w.uint32(18).bytes(m.hash); + return w; + }; + PartSetHeader.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.tendermint.types.PartSetHeader(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + m.total = r.uint32(); + break; + case 2: + m.hash = r.bytes(); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return PartSetHeader; + })(); + types.Part = (function () { + function Part(p) { + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + Part.prototype.index = 0; + Part.prototype.bytes = $util.newBuffer([]); + Part.prototype.proof = null; + Part.create = function create(properties) { + return new Part(properties); + }; + Part.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.index != null && Object.hasOwnProperty.call(m, "index")) w.uint32(8).uint32(m.index); + if (m.bytes != null && Object.hasOwnProperty.call(m, "bytes")) w.uint32(18).bytes(m.bytes); + if (m.proof != null && Object.hasOwnProperty.call(m, "proof")) + $root.tendermint.crypto.Proof.encode(m.proof, w.uint32(26).fork()).ldelim(); + return w; + }; + Part.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.tendermint.types.Part(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + m.index = r.uint32(); + break; + case 2: + m.bytes = r.bytes(); + break; + case 3: + m.proof = $root.tendermint.crypto.Proof.decode(r, r.uint32()); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return Part; + })(); + types.BlockID = (function () { + function BlockID(p) { + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + BlockID.prototype.hash = $util.newBuffer([]); + BlockID.prototype.partSetHeader = null; + BlockID.create = function create(properties) { + return new BlockID(properties); + }; + BlockID.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.hash != null && Object.hasOwnProperty.call(m, "hash")) w.uint32(10).bytes(m.hash); + if (m.partSetHeader != null && Object.hasOwnProperty.call(m, "partSetHeader")) + $root.tendermint.types.PartSetHeader.encode(m.partSetHeader, w.uint32(18).fork()).ldelim(); + return w; + }; + BlockID.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.tendermint.types.BlockID(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + m.hash = r.bytes(); + break; + case 2: + m.partSetHeader = $root.tendermint.types.PartSetHeader.decode(r, r.uint32()); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return BlockID; + })(); + types.Header = (function () { + function Header(p) { + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + Header.prototype.version = null; + Header.prototype.chainId = ""; + Header.prototype.height = $util.Long ? $util.Long.fromBits(0, 0, false) : 0; + Header.prototype.time = null; + Header.prototype.lastBlockId = null; + Header.prototype.lastCommitHash = $util.newBuffer([]); + Header.prototype.dataHash = $util.newBuffer([]); + Header.prototype.validatorsHash = $util.newBuffer([]); + Header.prototype.nextValidatorsHash = $util.newBuffer([]); + Header.prototype.consensusHash = $util.newBuffer([]); + Header.prototype.appHash = $util.newBuffer([]); + Header.prototype.lastResultsHash = $util.newBuffer([]); + Header.prototype.evidenceHash = $util.newBuffer([]); + Header.prototype.proposerAddress = $util.newBuffer([]); + Header.create = function create(properties) { + return new Header(properties); + }; + Header.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.version != null && Object.hasOwnProperty.call(m, "version")) + $root.tendermint.version.Consensus.encode(m.version, w.uint32(10).fork()).ldelim(); + if (m.chainId != null && Object.hasOwnProperty.call(m, "chainId")) w.uint32(18).string(m.chainId); + if (m.height != null && Object.hasOwnProperty.call(m, "height")) w.uint32(24).int64(m.height); + if (m.time != null && Object.hasOwnProperty.call(m, "time")) + $root.google.protobuf.Timestamp.encode(m.time, w.uint32(34).fork()).ldelim(); + if (m.lastBlockId != null && Object.hasOwnProperty.call(m, "lastBlockId")) + $root.tendermint.types.BlockID.encode(m.lastBlockId, w.uint32(42).fork()).ldelim(); + if (m.lastCommitHash != null && Object.hasOwnProperty.call(m, "lastCommitHash")) + w.uint32(50).bytes(m.lastCommitHash); + if (m.dataHash != null && Object.hasOwnProperty.call(m, "dataHash")) w.uint32(58).bytes(m.dataHash); + if (m.validatorsHash != null && Object.hasOwnProperty.call(m, "validatorsHash")) + w.uint32(66).bytes(m.validatorsHash); + if (m.nextValidatorsHash != null && Object.hasOwnProperty.call(m, "nextValidatorsHash")) + w.uint32(74).bytes(m.nextValidatorsHash); + if (m.consensusHash != null && Object.hasOwnProperty.call(m, "consensusHash")) + w.uint32(82).bytes(m.consensusHash); + if (m.appHash != null && Object.hasOwnProperty.call(m, "appHash")) w.uint32(90).bytes(m.appHash); + if (m.lastResultsHash != null && Object.hasOwnProperty.call(m, "lastResultsHash")) + w.uint32(98).bytes(m.lastResultsHash); + if (m.evidenceHash != null && Object.hasOwnProperty.call(m, "evidenceHash")) + w.uint32(106).bytes(m.evidenceHash); + if (m.proposerAddress != null && Object.hasOwnProperty.call(m, "proposerAddress")) + w.uint32(114).bytes(m.proposerAddress); + return w; + }; + Header.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.tendermint.types.Header(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + m.version = $root.tendermint.version.Consensus.decode(r, r.uint32()); + break; + case 2: + m.chainId = r.string(); + break; + case 3: + m.height = r.int64(); + break; + case 4: + m.time = $root.google.protobuf.Timestamp.decode(r, r.uint32()); + break; + case 5: + m.lastBlockId = $root.tendermint.types.BlockID.decode(r, r.uint32()); + break; + case 6: + m.lastCommitHash = r.bytes(); + break; + case 7: + m.dataHash = r.bytes(); + break; + case 8: + m.validatorsHash = r.bytes(); + break; + case 9: + m.nextValidatorsHash = r.bytes(); + break; + case 10: + m.consensusHash = r.bytes(); + break; + case 11: + m.appHash = r.bytes(); + break; + case 12: + m.lastResultsHash = r.bytes(); + break; + case 13: + m.evidenceHash = r.bytes(); + break; + case 14: + m.proposerAddress = r.bytes(); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return Header; + })(); + types.Data = (function () { + function Data(p) { + this.txs = []; + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + Data.prototype.txs = $util.emptyArray; + Data.prototype.hash = $util.newBuffer([]); + Data.create = function create(properties) { + return new Data(properties); + }; + Data.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.txs != null && m.txs.length) { + for (var i = 0; i < m.txs.length; ++i) w.uint32(10).bytes(m.txs[i]); + } + if (m.hash != null && Object.hasOwnProperty.call(m, "hash")) w.uint32(18).bytes(m.hash); + return w; + }; + Data.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.tendermint.types.Data(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + if (!(m.txs && m.txs.length)) m.txs = []; + m.txs.push(r.bytes()); + break; + case 2: + m.hash = r.bytes(); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return Data; + })(); + types.Vote = (function () { + function Vote(p) { + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + Vote.prototype.type = 0; + Vote.prototype.height = $util.Long ? $util.Long.fromBits(0, 0, false) : 0; + Vote.prototype.round = 0; + Vote.prototype.blockId = null; + Vote.prototype.timestamp = null; + Vote.prototype.validatorAddress = $util.newBuffer([]); + Vote.prototype.validatorIndex = 0; + Vote.prototype.signature = $util.newBuffer([]); + Vote.create = function create(properties) { + return new Vote(properties); + }; + Vote.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.type != null && Object.hasOwnProperty.call(m, "type")) w.uint32(8).int32(m.type); + if (m.height != null && Object.hasOwnProperty.call(m, "height")) w.uint32(16).int64(m.height); + if (m.round != null && Object.hasOwnProperty.call(m, "round")) w.uint32(24).int32(m.round); + if (m.blockId != null && Object.hasOwnProperty.call(m, "blockId")) + $root.tendermint.types.BlockID.encode(m.blockId, w.uint32(34).fork()).ldelim(); + if (m.timestamp != null && Object.hasOwnProperty.call(m, "timestamp")) + $root.google.protobuf.Timestamp.encode(m.timestamp, w.uint32(42).fork()).ldelim(); + if (m.validatorAddress != null && Object.hasOwnProperty.call(m, "validatorAddress")) + w.uint32(50).bytes(m.validatorAddress); + if (m.validatorIndex != null && Object.hasOwnProperty.call(m, "validatorIndex")) + w.uint32(56).int32(m.validatorIndex); + if (m.signature != null && Object.hasOwnProperty.call(m, "signature")) + w.uint32(66).bytes(m.signature); + return w; + }; + Vote.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.tendermint.types.Vote(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + m.type = r.int32(); + break; + case 2: + m.height = r.int64(); + break; + case 3: + m.round = r.int32(); + break; + case 4: + m.blockId = $root.tendermint.types.BlockID.decode(r, r.uint32()); + break; + case 5: + m.timestamp = $root.google.protobuf.Timestamp.decode(r, r.uint32()); + break; + case 6: + m.validatorAddress = r.bytes(); + break; + case 7: + m.validatorIndex = r.int32(); + break; + case 8: + m.signature = r.bytes(); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return Vote; + })(); + types.Commit = (function () { + function Commit(p) { + this.signatures = []; + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + Commit.prototype.height = $util.Long ? $util.Long.fromBits(0, 0, false) : 0; + Commit.prototype.round = 0; + Commit.prototype.blockId = null; + Commit.prototype.signatures = $util.emptyArray; + Commit.prototype.hash = $util.newBuffer([]); + Commit.prototype.bitArray = null; + Commit.create = function create(properties) { + return new Commit(properties); + }; + Commit.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.height != null && Object.hasOwnProperty.call(m, "height")) w.uint32(8).int64(m.height); + if (m.round != null && Object.hasOwnProperty.call(m, "round")) w.uint32(16).int32(m.round); + if (m.blockId != null && Object.hasOwnProperty.call(m, "blockId")) + $root.tendermint.types.BlockID.encode(m.blockId, w.uint32(26).fork()).ldelim(); + if (m.signatures != null && m.signatures.length) { + for (var i = 0; i < m.signatures.length; ++i) + $root.tendermint.types.CommitSig.encode(m.signatures[i], w.uint32(34).fork()).ldelim(); + } + if (m.hash != null && Object.hasOwnProperty.call(m, "hash")) w.uint32(42).bytes(m.hash); + if (m.bitArray != null && Object.hasOwnProperty.call(m, "bitArray")) + $root.tendermint.libs.bits.BitArray.encode(m.bitArray, w.uint32(50).fork()).ldelim(); + return w; + }; + Commit.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.tendermint.types.Commit(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + m.height = r.int64(); + break; + case 2: + m.round = r.int32(); + break; + case 3: + m.blockId = $root.tendermint.types.BlockID.decode(r, r.uint32()); + break; + case 4: + if (!(m.signatures && m.signatures.length)) m.signatures = []; + m.signatures.push($root.tendermint.types.CommitSig.decode(r, r.uint32())); + break; + case 5: + m.hash = r.bytes(); + break; + case 6: + m.bitArray = $root.tendermint.libs.bits.BitArray.decode(r, r.uint32()); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return Commit; + })(); + types.CommitSig = (function () { + function CommitSig(p) { + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + CommitSig.prototype.blockIdFlag = 0; + CommitSig.prototype.validatorAddress = $util.newBuffer([]); + CommitSig.prototype.timestamp = null; + CommitSig.prototype.signature = $util.newBuffer([]); + CommitSig.create = function create(properties) { + return new CommitSig(properties); + }; + CommitSig.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.blockIdFlag != null && Object.hasOwnProperty.call(m, "blockIdFlag")) + w.uint32(8).int32(m.blockIdFlag); + if (m.validatorAddress != null && Object.hasOwnProperty.call(m, "validatorAddress")) + w.uint32(18).bytes(m.validatorAddress); + if (m.timestamp != null && Object.hasOwnProperty.call(m, "timestamp")) + $root.google.protobuf.Timestamp.encode(m.timestamp, w.uint32(26).fork()).ldelim(); + if (m.signature != null && Object.hasOwnProperty.call(m, "signature")) + w.uint32(34).bytes(m.signature); + return w; + }; + CommitSig.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.tendermint.types.CommitSig(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + m.blockIdFlag = r.int32(); + break; + case 2: + m.validatorAddress = r.bytes(); + break; + case 3: + m.timestamp = $root.google.protobuf.Timestamp.decode(r, r.uint32()); + break; + case 4: + m.signature = r.bytes(); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return CommitSig; + })(); + types.Proposal = (function () { + function Proposal(p) { + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + Proposal.prototype.type = 0; + Proposal.prototype.height = $util.Long ? $util.Long.fromBits(0, 0, false) : 0; + Proposal.prototype.round = 0; + Proposal.prototype.polRound = 0; + Proposal.prototype.blockId = null; + Proposal.prototype.timestamp = null; + Proposal.prototype.signature = $util.newBuffer([]); + Proposal.create = function create(properties) { + return new Proposal(properties); + }; + Proposal.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.type != null && Object.hasOwnProperty.call(m, "type")) w.uint32(8).int32(m.type); + if (m.height != null && Object.hasOwnProperty.call(m, "height")) w.uint32(16).int64(m.height); + if (m.round != null && Object.hasOwnProperty.call(m, "round")) w.uint32(24).int32(m.round); + if (m.polRound != null && Object.hasOwnProperty.call(m, "polRound")) w.uint32(32).int32(m.polRound); + if (m.blockId != null && Object.hasOwnProperty.call(m, "blockId")) + $root.tendermint.types.BlockID.encode(m.blockId, w.uint32(42).fork()).ldelim(); + if (m.timestamp != null && Object.hasOwnProperty.call(m, "timestamp")) + $root.google.protobuf.Timestamp.encode(m.timestamp, w.uint32(50).fork()).ldelim(); + if (m.signature != null && Object.hasOwnProperty.call(m, "signature")) + w.uint32(58).bytes(m.signature); + return w; + }; + Proposal.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.tendermint.types.Proposal(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + m.type = r.int32(); + break; + case 2: + m.height = r.int64(); + break; + case 3: + m.round = r.int32(); + break; + case 4: + m.polRound = r.int32(); + break; + case 5: + m.blockId = $root.tendermint.types.BlockID.decode(r, r.uint32()); + break; + case 6: + m.timestamp = $root.google.protobuf.Timestamp.decode(r, r.uint32()); + break; + case 7: + m.signature = r.bytes(); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return Proposal; + })(); + types.SignedHeader = (function () { + function SignedHeader(p) { + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + SignedHeader.prototype.header = null; + SignedHeader.prototype.commit = null; + SignedHeader.create = function create(properties) { + return new SignedHeader(properties); + }; + SignedHeader.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.header != null && Object.hasOwnProperty.call(m, "header")) + $root.tendermint.types.Header.encode(m.header, w.uint32(10).fork()).ldelim(); + if (m.commit != null && Object.hasOwnProperty.call(m, "commit")) + $root.tendermint.types.Commit.encode(m.commit, w.uint32(18).fork()).ldelim(); + return w; + }; + SignedHeader.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.tendermint.types.SignedHeader(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + m.header = $root.tendermint.types.Header.decode(r, r.uint32()); + break; + case 2: + m.commit = $root.tendermint.types.Commit.decode(r, r.uint32()); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return SignedHeader; + })(); + types.LightBlock = (function () { + function LightBlock(p) { + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + LightBlock.prototype.signedHeader = null; + LightBlock.prototype.validatorSet = null; + LightBlock.create = function create(properties) { + return new LightBlock(properties); + }; + LightBlock.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.signedHeader != null && Object.hasOwnProperty.call(m, "signedHeader")) + $root.tendermint.types.SignedHeader.encode(m.signedHeader, w.uint32(10).fork()).ldelim(); + if (m.validatorSet != null && Object.hasOwnProperty.call(m, "validatorSet")) + $root.tendermint.types.ValidatorSet.encode(m.validatorSet, w.uint32(18).fork()).ldelim(); + return w; + }; + LightBlock.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.tendermint.types.LightBlock(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + m.signedHeader = $root.tendermint.types.SignedHeader.decode(r, r.uint32()); + break; + case 2: + m.validatorSet = $root.tendermint.types.ValidatorSet.decode(r, r.uint32()); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return LightBlock; + })(); + types.BlockMeta = (function () { + function BlockMeta(p) { + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + BlockMeta.prototype.blockId = null; + BlockMeta.prototype.blockSize = $util.Long ? $util.Long.fromBits(0, 0, false) : 0; + BlockMeta.prototype.header = null; + BlockMeta.prototype.numTxs = $util.Long ? $util.Long.fromBits(0, 0, false) : 0; + BlockMeta.create = function create(properties) { + return new BlockMeta(properties); + }; + BlockMeta.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.blockId != null && Object.hasOwnProperty.call(m, "blockId")) + $root.tendermint.types.BlockID.encode(m.blockId, w.uint32(10).fork()).ldelim(); + if (m.blockSize != null && Object.hasOwnProperty.call(m, "blockSize")) + w.uint32(16).int64(m.blockSize); + if (m.header != null && Object.hasOwnProperty.call(m, "header")) + $root.tendermint.types.Header.encode(m.header, w.uint32(26).fork()).ldelim(); + if (m.numTxs != null && Object.hasOwnProperty.call(m, "numTxs")) w.uint32(32).int64(m.numTxs); + return w; + }; + BlockMeta.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.tendermint.types.BlockMeta(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + m.blockId = $root.tendermint.types.BlockID.decode(r, r.uint32()); + break; + case 2: + m.blockSize = r.int64(); + break; + case 3: + m.header = $root.tendermint.types.Header.decode(r, r.uint32()); + break; + case 4: + m.numTxs = r.int64(); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return BlockMeta; + })(); + types.TxProof = (function () { + function TxProof(p) { + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + TxProof.prototype.rootHash = $util.newBuffer([]); + TxProof.prototype.data = $util.newBuffer([]); + TxProof.prototype.proof = null; + TxProof.create = function create(properties) { + return new TxProof(properties); + }; + TxProof.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.rootHash != null && Object.hasOwnProperty.call(m, "rootHash")) w.uint32(10).bytes(m.rootHash); + if (m.data != null && Object.hasOwnProperty.call(m, "data")) w.uint32(18).bytes(m.data); + if (m.proof != null && Object.hasOwnProperty.call(m, "proof")) + $root.tendermint.crypto.Proof.encode(m.proof, w.uint32(26).fork()).ldelim(); + return w; + }; + TxProof.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.tendermint.types.TxProof(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + m.rootHash = r.bytes(); + break; + case 2: + m.data = r.bytes(); + break; + case 3: + m.proof = $root.tendermint.crypto.Proof.decode(r, r.uint32()); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return TxProof; + })(); + types.ValidatorSet = (function () { + function ValidatorSet(p) { + this.validators = []; + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + ValidatorSet.prototype.validators = $util.emptyArray; + ValidatorSet.prototype.proposer = null; + ValidatorSet.prototype.totalVotingPower = $util.Long ? $util.Long.fromBits(0, 0, false) : 0; + ValidatorSet.create = function create(properties) { + return new ValidatorSet(properties); + }; + ValidatorSet.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.validators != null && m.validators.length) { + for (var i = 0; i < m.validators.length; ++i) + $root.tendermint.types.Validator.encode(m.validators[i], w.uint32(10).fork()).ldelim(); + } + if (m.proposer != null && Object.hasOwnProperty.call(m, "proposer")) + $root.tendermint.types.Validator.encode(m.proposer, w.uint32(18).fork()).ldelim(); + if (m.totalVotingPower != null && Object.hasOwnProperty.call(m, "totalVotingPower")) + w.uint32(24).int64(m.totalVotingPower); + return w; + }; + ValidatorSet.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.tendermint.types.ValidatorSet(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + if (!(m.validators && m.validators.length)) m.validators = []; + m.validators.push($root.tendermint.types.Validator.decode(r, r.uint32())); + break; + case 2: + m.proposer = $root.tendermint.types.Validator.decode(r, r.uint32()); + break; + case 3: + m.totalVotingPower = r.int64(); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return ValidatorSet; + })(); + types.Validator = (function () { + function Validator(p) { + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + Validator.prototype.address = $util.newBuffer([]); + Validator.prototype.pubKey = null; + Validator.prototype.votingPower = $util.Long ? $util.Long.fromBits(0, 0, false) : 0; + Validator.prototype.proposerPriority = $util.Long ? $util.Long.fromBits(0, 0, false) : 0; + Validator.create = function create(properties) { + return new Validator(properties); + }; + Validator.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.address != null && Object.hasOwnProperty.call(m, "address")) w.uint32(10).bytes(m.address); + if (m.pubKey != null && Object.hasOwnProperty.call(m, "pubKey")) + $root.tendermint.crypto.PublicKey.encode(m.pubKey, w.uint32(18).fork()).ldelim(); + if (m.votingPower != null && Object.hasOwnProperty.call(m, "votingPower")) + w.uint32(24).int64(m.votingPower); + if (m.proposerPriority != null && Object.hasOwnProperty.call(m, "proposerPriority")) + w.uint32(32).int64(m.proposerPriority); + return w; + }; + Validator.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.tendermint.types.Validator(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + m.address = r.bytes(); + break; + case 2: + m.pubKey = $root.tendermint.crypto.PublicKey.decode(r, r.uint32()); + break; + case 3: + m.votingPower = r.int64(); + break; + case 4: + m.proposerPriority = r.int64(); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return Validator; + })(); + types.SimpleValidator = (function () { + function SimpleValidator(p) { + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + SimpleValidator.prototype.pubKey = null; + SimpleValidator.prototype.votingPower = $util.Long ? $util.Long.fromBits(0, 0, false) : 0; + SimpleValidator.create = function create(properties) { + return new SimpleValidator(properties); + }; + SimpleValidator.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.pubKey != null && Object.hasOwnProperty.call(m, "pubKey")) + $root.tendermint.crypto.PublicKey.encode(m.pubKey, w.uint32(10).fork()).ldelim(); + if (m.votingPower != null && Object.hasOwnProperty.call(m, "votingPower")) + w.uint32(16).int64(m.votingPower); + return w; + }; + SimpleValidator.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.tendermint.types.SimpleValidator(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + m.pubKey = $root.tendermint.crypto.PublicKey.decode(r, r.uint32()); + break; + case 2: + m.votingPower = r.int64(); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return SimpleValidator; + })(); + return types; + })(); + tendermint.version = (function () { + const version = {}; + version.App = (function () { + function App(p) { + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + App.prototype.protocol = $util.Long ? $util.Long.fromBits(0, 0, true) : 0; + App.prototype.software = ""; + App.create = function create(properties) { + return new App(properties); + }; + App.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.protocol != null && Object.hasOwnProperty.call(m, "protocol")) w.uint32(8).uint64(m.protocol); + if (m.software != null && Object.hasOwnProperty.call(m, "software")) w.uint32(18).string(m.software); + return w; + }; + App.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.tendermint.version.App(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + m.protocol = r.uint64(); + break; + case 2: + m.software = r.string(); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return App; + })(); + version.Consensus = (function () { + function Consensus(p) { + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + Consensus.prototype.block = $util.Long ? $util.Long.fromBits(0, 0, true) : 0; + Consensus.prototype.app = $util.Long ? $util.Long.fromBits(0, 0, true) : 0; + Consensus.create = function create(properties) { + return new Consensus(properties); + }; + Consensus.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.block != null && Object.hasOwnProperty.call(m, "block")) w.uint32(8).uint64(m.block); + if (m.app != null && Object.hasOwnProperty.call(m, "app")) w.uint32(16).uint64(m.app); + return w; + }; + Consensus.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.tendermint.version.Consensus(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + m.block = r.uint64(); + break; + case 2: + m.app = r.uint64(); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return Consensus; + })(); + return version; + })(); return tendermint; })(); module.exports = $root; diff --git a/packages/stargate/types/codec/generated/codecimpl.d.ts b/packages/stargate/types/codec/generated/codecimpl.d.ts index e348516f..346edf38 100644 --- a/packages/stargate/types/codec/generated/codecimpl.d.ts +++ b/packages/stargate/types/codec/generated/codecimpl.d.ts @@ -1695,6 +1695,1564 @@ export namespace cosmos { } } + /** Namespace staking. */ + namespace staking { + /** Namespace v1beta1. */ + namespace v1beta1 { + /** Properties of a HistoricalInfo. */ + interface IHistoricalInfo { + /** HistoricalInfo header */ + header?: tendermint.types.IHeader | null; + + /** HistoricalInfo valset */ + valset?: cosmos.staking.v1beta1.IValidator[] | null; + } + + /** Represents a HistoricalInfo. */ + class HistoricalInfo implements IHistoricalInfo { + /** + * Constructs a new HistoricalInfo. + * @param [p] Properties to set + */ + constructor(p?: cosmos.staking.v1beta1.IHistoricalInfo); + + /** HistoricalInfo header. */ + public header?: tendermint.types.IHeader | null; + + /** HistoricalInfo valset. */ + public valset: cosmos.staking.v1beta1.IValidator[]; + + /** + * Creates a new HistoricalInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns HistoricalInfo instance + */ + public static create( + properties?: cosmos.staking.v1beta1.IHistoricalInfo, + ): cosmos.staking.v1beta1.HistoricalInfo; + + /** + * Encodes the specified HistoricalInfo message. Does not implicitly {@link cosmos.staking.v1beta1.HistoricalInfo.verify|verify} messages. + * @param m HistoricalInfo message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode( + m: cosmos.staking.v1beta1.IHistoricalInfo, + w?: $protobuf.Writer, + ): $protobuf.Writer; + + /** + * Decodes a HistoricalInfo message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns HistoricalInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode( + r: $protobuf.Reader | Uint8Array, + l?: number, + ): cosmos.staking.v1beta1.HistoricalInfo; + } + + /** Properties of a CommissionRates. */ + interface ICommissionRates { + /** CommissionRates rate */ + rate?: string | null; + + /** CommissionRates maxRate */ + maxRate?: string | null; + + /** CommissionRates maxChangeRate */ + maxChangeRate?: string | null; + } + + /** Represents a CommissionRates. */ + class CommissionRates implements ICommissionRates { + /** + * Constructs a new CommissionRates. + * @param [p] Properties to set + */ + constructor(p?: cosmos.staking.v1beta1.ICommissionRates); + + /** CommissionRates rate. */ + public rate: string; + + /** CommissionRates maxRate. */ + public maxRate: string; + + /** CommissionRates maxChangeRate. */ + public maxChangeRate: string; + + /** + * Creates a new CommissionRates instance using the specified properties. + * @param [properties] Properties to set + * @returns CommissionRates instance + */ + public static create( + properties?: cosmos.staking.v1beta1.ICommissionRates, + ): cosmos.staking.v1beta1.CommissionRates; + + /** + * Encodes the specified CommissionRates message. Does not implicitly {@link cosmos.staking.v1beta1.CommissionRates.verify|verify} messages. + * @param m CommissionRates message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode( + m: cosmos.staking.v1beta1.ICommissionRates, + w?: $protobuf.Writer, + ): $protobuf.Writer; + + /** + * Decodes a CommissionRates message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns CommissionRates + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode( + r: $protobuf.Reader | Uint8Array, + l?: number, + ): cosmos.staking.v1beta1.CommissionRates; + } + + /** Properties of a Commission. */ + interface ICommission { + /** Commission commissionRates */ + commissionRates?: cosmos.staking.v1beta1.ICommissionRates | null; + + /** Commission updateTime */ + updateTime?: google.protobuf.ITimestamp | null; + } + + /** Represents a Commission. */ + class Commission implements ICommission { + /** + * Constructs a new Commission. + * @param [p] Properties to set + */ + constructor(p?: cosmos.staking.v1beta1.ICommission); + + /** Commission commissionRates. */ + public commissionRates?: cosmos.staking.v1beta1.ICommissionRates | null; + + /** Commission updateTime. */ + public updateTime?: google.protobuf.ITimestamp | null; + + /** + * Creates a new Commission instance using the specified properties. + * @param [properties] Properties to set + * @returns Commission instance + */ + public static create( + properties?: cosmos.staking.v1beta1.ICommission, + ): cosmos.staking.v1beta1.Commission; + + /** + * Encodes the specified Commission message. Does not implicitly {@link cosmos.staking.v1beta1.Commission.verify|verify} messages. + * @param m Commission message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: cosmos.staking.v1beta1.ICommission, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Commission message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns Commission + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): cosmos.staking.v1beta1.Commission; + } + + /** Properties of a Description. */ + interface IDescription { + /** Description moniker */ + moniker?: string | null; + + /** Description identity */ + identity?: string | null; + + /** Description website */ + website?: string | null; + + /** Description securityContact */ + securityContact?: string | null; + + /** Description details */ + details?: string | null; + } + + /** Represents a Description. */ + class Description implements IDescription { + /** + * Constructs a new Description. + * @param [p] Properties to set + */ + constructor(p?: cosmos.staking.v1beta1.IDescription); + + /** Description moniker. */ + public moniker: string; + + /** Description identity. */ + public identity: string; + + /** Description website. */ + public website: string; + + /** Description securityContact. */ + public securityContact: string; + + /** Description details. */ + public details: string; + + /** + * Creates a new Description instance using the specified properties. + * @param [properties] Properties to set + * @returns Description instance + */ + public static create( + properties?: cosmos.staking.v1beta1.IDescription, + ): cosmos.staking.v1beta1.Description; + + /** + * Encodes the specified Description message. Does not implicitly {@link cosmos.staking.v1beta1.Description.verify|verify} messages. + * @param m Description message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: cosmos.staking.v1beta1.IDescription, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Description message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns Description + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode( + r: $protobuf.Reader | Uint8Array, + l?: number, + ): cosmos.staking.v1beta1.Description; + } + + /** Properties of a Validator. */ + interface IValidator { + /** Validator operatorAddress */ + operatorAddress?: string | null; + + /** Validator consensusPubkey */ + consensusPubkey?: string | null; + + /** Validator jailed */ + jailed?: boolean | null; + + /** Validator status */ + status?: number | null; + + /** Validator tokens */ + tokens?: string | null; + + /** Validator delegatorShares */ + delegatorShares?: string | null; + + /** Validator description */ + description?: cosmos.staking.v1beta1.IDescription | null; + + /** Validator unbondingHeight */ + unbondingHeight?: Long | null; + + /** Validator unbondingTime */ + unbondingTime?: google.protobuf.ITimestamp | null; + + /** Validator commission */ + commission?: cosmos.staking.v1beta1.ICommission | null; + + /** Validator minSelfDelegation */ + minSelfDelegation?: string | null; + } + + /** Represents a Validator. */ + class Validator implements IValidator { + /** + * Constructs a new Validator. + * @param [p] Properties to set + */ + constructor(p?: cosmos.staking.v1beta1.IValidator); + + /** Validator operatorAddress. */ + public operatorAddress: string; + + /** Validator consensusPubkey. */ + public consensusPubkey: string; + + /** Validator jailed. */ + public jailed: boolean; + + /** Validator status. */ + public status: number; + + /** Validator tokens. */ + public tokens: string; + + /** Validator delegatorShares. */ + public delegatorShares: string; + + /** Validator description. */ + public description?: cosmos.staking.v1beta1.IDescription | null; + + /** Validator unbondingHeight. */ + public unbondingHeight: Long; + + /** Validator unbondingTime. */ + public unbondingTime?: google.protobuf.ITimestamp | null; + + /** Validator commission. */ + public commission?: cosmos.staking.v1beta1.ICommission | null; + + /** Validator minSelfDelegation. */ + public minSelfDelegation: string; + + /** + * Creates a new Validator instance using the specified properties. + * @param [properties] Properties to set + * @returns Validator instance + */ + public static create( + properties?: cosmos.staking.v1beta1.IValidator, + ): cosmos.staking.v1beta1.Validator; + + /** + * Encodes the specified Validator message. Does not implicitly {@link cosmos.staking.v1beta1.Validator.verify|verify} messages. + * @param m Validator message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: cosmos.staking.v1beta1.IValidator, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Validator message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns Validator + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): cosmos.staking.v1beta1.Validator; + } + + /** Properties of a ValAddresses. */ + interface IValAddresses { + /** ValAddresses addresses */ + addresses?: string[] | null; + } + + /** Represents a ValAddresses. */ + class ValAddresses implements IValAddresses { + /** + * Constructs a new ValAddresses. + * @param [p] Properties to set + */ + constructor(p?: cosmos.staking.v1beta1.IValAddresses); + + /** ValAddresses addresses. */ + public addresses: string[]; + + /** + * Creates a new ValAddresses instance using the specified properties. + * @param [properties] Properties to set + * @returns ValAddresses instance + */ + public static create( + properties?: cosmos.staking.v1beta1.IValAddresses, + ): cosmos.staking.v1beta1.ValAddresses; + + /** + * Encodes the specified ValAddresses message. Does not implicitly {@link cosmos.staking.v1beta1.ValAddresses.verify|verify} messages. + * @param m ValAddresses message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: cosmos.staking.v1beta1.IValAddresses, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ValAddresses message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns ValAddresses + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode( + r: $protobuf.Reader | Uint8Array, + l?: number, + ): cosmos.staking.v1beta1.ValAddresses; + } + + /** Properties of a DVPair. */ + interface IDVPair { + /** DVPair delegatorAddress */ + delegatorAddress?: string | null; + + /** DVPair validatorAddress */ + validatorAddress?: string | null; + } + + /** Represents a DVPair. */ + class DVPair implements IDVPair { + /** + * Constructs a new DVPair. + * @param [p] Properties to set + */ + constructor(p?: cosmos.staking.v1beta1.IDVPair); + + /** DVPair delegatorAddress. */ + public delegatorAddress: string; + + /** DVPair validatorAddress. */ + public validatorAddress: string; + + /** + * Creates a new DVPair instance using the specified properties. + * @param [properties] Properties to set + * @returns DVPair instance + */ + public static create(properties?: cosmos.staking.v1beta1.IDVPair): cosmos.staking.v1beta1.DVPair; + + /** + * Encodes the specified DVPair message. Does not implicitly {@link cosmos.staking.v1beta1.DVPair.verify|verify} messages. + * @param m DVPair message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: cosmos.staking.v1beta1.IDVPair, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DVPair message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns DVPair + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): cosmos.staking.v1beta1.DVPair; + } + + /** Properties of a DVPairs. */ + interface IDVPairs { + /** DVPairs pairs */ + pairs?: cosmos.staking.v1beta1.IDVPair[] | null; + } + + /** Represents a DVPairs. */ + class DVPairs implements IDVPairs { + /** + * Constructs a new DVPairs. + * @param [p] Properties to set + */ + constructor(p?: cosmos.staking.v1beta1.IDVPairs); + + /** DVPairs pairs. */ + public pairs: cosmos.staking.v1beta1.IDVPair[]; + + /** + * Creates a new DVPairs instance using the specified properties. + * @param [properties] Properties to set + * @returns DVPairs instance + */ + public static create(properties?: cosmos.staking.v1beta1.IDVPairs): cosmos.staking.v1beta1.DVPairs; + + /** + * Encodes the specified DVPairs message. Does not implicitly {@link cosmos.staking.v1beta1.DVPairs.verify|verify} messages. + * @param m DVPairs message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: cosmos.staking.v1beta1.IDVPairs, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DVPairs message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns DVPairs + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): cosmos.staking.v1beta1.DVPairs; + } + + /** Properties of a DVVTriplet. */ + interface IDVVTriplet { + /** DVVTriplet delegatorAddress */ + delegatorAddress?: string | null; + + /** DVVTriplet validatorSrcAddress */ + validatorSrcAddress?: string | null; + + /** DVVTriplet validatorDstAddress */ + validatorDstAddress?: string | null; + } + + /** Represents a DVVTriplet. */ + class DVVTriplet implements IDVVTriplet { + /** + * Constructs a new DVVTriplet. + * @param [p] Properties to set + */ + constructor(p?: cosmos.staking.v1beta1.IDVVTriplet); + + /** DVVTriplet delegatorAddress. */ + public delegatorAddress: string; + + /** DVVTriplet validatorSrcAddress. */ + public validatorSrcAddress: string; + + /** DVVTriplet validatorDstAddress. */ + public validatorDstAddress: string; + + /** + * Creates a new DVVTriplet instance using the specified properties. + * @param [properties] Properties to set + * @returns DVVTriplet instance + */ + public static create( + properties?: cosmos.staking.v1beta1.IDVVTriplet, + ): cosmos.staking.v1beta1.DVVTriplet; + + /** + * Encodes the specified DVVTriplet message. Does not implicitly {@link cosmos.staking.v1beta1.DVVTriplet.verify|verify} messages. + * @param m DVVTriplet message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: cosmos.staking.v1beta1.IDVVTriplet, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DVVTriplet message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns DVVTriplet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): cosmos.staking.v1beta1.DVVTriplet; + } + + /** Properties of a DVVTriplets. */ + interface IDVVTriplets { + /** DVVTriplets triplets */ + triplets?: cosmos.staking.v1beta1.IDVVTriplet[] | null; + } + + /** Represents a DVVTriplets. */ + class DVVTriplets implements IDVVTriplets { + /** + * Constructs a new DVVTriplets. + * @param [p] Properties to set + */ + constructor(p?: cosmos.staking.v1beta1.IDVVTriplets); + + /** DVVTriplets triplets. */ + public triplets: cosmos.staking.v1beta1.IDVVTriplet[]; + + /** + * Creates a new DVVTriplets instance using the specified properties. + * @param [properties] Properties to set + * @returns DVVTriplets instance + */ + public static create( + properties?: cosmos.staking.v1beta1.IDVVTriplets, + ): cosmos.staking.v1beta1.DVVTriplets; + + /** + * Encodes the specified DVVTriplets message. Does not implicitly {@link cosmos.staking.v1beta1.DVVTriplets.verify|verify} messages. + * @param m DVVTriplets message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: cosmos.staking.v1beta1.IDVVTriplets, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DVVTriplets message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns DVVTriplets + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode( + r: $protobuf.Reader | Uint8Array, + l?: number, + ): cosmos.staking.v1beta1.DVVTriplets; + } + + /** Properties of a Delegation. */ + interface IDelegation { + /** Delegation delegatorAddress */ + delegatorAddress?: string | null; + + /** Delegation validatorAddress */ + validatorAddress?: string | null; + + /** Delegation shares */ + shares?: string | null; + } + + /** Represents a Delegation. */ + class Delegation implements IDelegation { + /** + * Constructs a new Delegation. + * @param [p] Properties to set + */ + constructor(p?: cosmos.staking.v1beta1.IDelegation); + + /** Delegation delegatorAddress. */ + public delegatorAddress: string; + + /** Delegation validatorAddress. */ + public validatorAddress: string; + + /** Delegation shares. */ + public shares: string; + + /** + * Creates a new Delegation instance using the specified properties. + * @param [properties] Properties to set + * @returns Delegation instance + */ + public static create( + properties?: cosmos.staking.v1beta1.IDelegation, + ): cosmos.staking.v1beta1.Delegation; + + /** + * Encodes the specified Delegation message. Does not implicitly {@link cosmos.staking.v1beta1.Delegation.verify|verify} messages. + * @param m Delegation message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: cosmos.staking.v1beta1.IDelegation, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Delegation message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns Delegation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): cosmos.staking.v1beta1.Delegation; + } + + /** Properties of an UnbondingDelegation. */ + interface IUnbondingDelegation { + /** UnbondingDelegation delegatorAddress */ + delegatorAddress?: string | null; + + /** UnbondingDelegation validatorAddress */ + validatorAddress?: string | null; + + /** UnbondingDelegation entries */ + entries?: cosmos.staking.v1beta1.IUnbondingDelegationEntry[] | null; + } + + /** Represents an UnbondingDelegation. */ + class UnbondingDelegation implements IUnbondingDelegation { + /** + * Constructs a new UnbondingDelegation. + * @param [p] Properties to set + */ + constructor(p?: cosmos.staking.v1beta1.IUnbondingDelegation); + + /** UnbondingDelegation delegatorAddress. */ + public delegatorAddress: string; + + /** UnbondingDelegation validatorAddress. */ + public validatorAddress: string; + + /** UnbondingDelegation entries. */ + public entries: cosmos.staking.v1beta1.IUnbondingDelegationEntry[]; + + /** + * Creates a new UnbondingDelegation instance using the specified properties. + * @param [properties] Properties to set + * @returns UnbondingDelegation instance + */ + public static create( + properties?: cosmos.staking.v1beta1.IUnbondingDelegation, + ): cosmos.staking.v1beta1.UnbondingDelegation; + + /** + * Encodes the specified UnbondingDelegation message. Does not implicitly {@link cosmos.staking.v1beta1.UnbondingDelegation.verify|verify} messages. + * @param m UnbondingDelegation message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode( + m: cosmos.staking.v1beta1.IUnbondingDelegation, + w?: $protobuf.Writer, + ): $protobuf.Writer; + + /** + * Decodes an UnbondingDelegation message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns UnbondingDelegation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode( + r: $protobuf.Reader | Uint8Array, + l?: number, + ): cosmos.staking.v1beta1.UnbondingDelegation; + } + + /** Properties of an UnbondingDelegationEntry. */ + interface IUnbondingDelegationEntry { + /** UnbondingDelegationEntry creationHeight */ + creationHeight?: Long | null; + + /** UnbondingDelegationEntry completionTime */ + completionTime?: google.protobuf.ITimestamp | null; + + /** UnbondingDelegationEntry initialBalance */ + initialBalance?: string | null; + + /** UnbondingDelegationEntry balance */ + balance?: string | null; + } + + /** Represents an UnbondingDelegationEntry. */ + class UnbondingDelegationEntry implements IUnbondingDelegationEntry { + /** + * Constructs a new UnbondingDelegationEntry. + * @param [p] Properties to set + */ + constructor(p?: cosmos.staking.v1beta1.IUnbondingDelegationEntry); + + /** UnbondingDelegationEntry creationHeight. */ + public creationHeight: Long; + + /** UnbondingDelegationEntry completionTime. */ + public completionTime?: google.protobuf.ITimestamp | null; + + /** UnbondingDelegationEntry initialBalance. */ + public initialBalance: string; + + /** UnbondingDelegationEntry balance. */ + public balance: string; + + /** + * Creates a new UnbondingDelegationEntry instance using the specified properties. + * @param [properties] Properties to set + * @returns UnbondingDelegationEntry instance + */ + public static create( + properties?: cosmos.staking.v1beta1.IUnbondingDelegationEntry, + ): cosmos.staking.v1beta1.UnbondingDelegationEntry; + + /** + * Encodes the specified UnbondingDelegationEntry message. Does not implicitly {@link cosmos.staking.v1beta1.UnbondingDelegationEntry.verify|verify} messages. + * @param m UnbondingDelegationEntry message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode( + m: cosmos.staking.v1beta1.IUnbondingDelegationEntry, + w?: $protobuf.Writer, + ): $protobuf.Writer; + + /** + * Decodes an UnbondingDelegationEntry message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns UnbondingDelegationEntry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode( + r: $protobuf.Reader | Uint8Array, + l?: number, + ): cosmos.staking.v1beta1.UnbondingDelegationEntry; + } + + /** Properties of a RedelegationEntry. */ + interface IRedelegationEntry { + /** RedelegationEntry creationHeight */ + creationHeight?: Long | null; + + /** RedelegationEntry completionTime */ + completionTime?: google.protobuf.ITimestamp | null; + + /** RedelegationEntry initialBalance */ + initialBalance?: string | null; + + /** RedelegationEntry sharesDst */ + sharesDst?: string | null; + } + + /** Represents a RedelegationEntry. */ + class RedelegationEntry implements IRedelegationEntry { + /** + * Constructs a new RedelegationEntry. + * @param [p] Properties to set + */ + constructor(p?: cosmos.staking.v1beta1.IRedelegationEntry); + + /** RedelegationEntry creationHeight. */ + public creationHeight: Long; + + /** RedelegationEntry completionTime. */ + public completionTime?: google.protobuf.ITimestamp | null; + + /** RedelegationEntry initialBalance. */ + public initialBalance: string; + + /** RedelegationEntry sharesDst. */ + public sharesDst: string; + + /** + * Creates a new RedelegationEntry instance using the specified properties. + * @param [properties] Properties to set + * @returns RedelegationEntry instance + */ + public static create( + properties?: cosmos.staking.v1beta1.IRedelegationEntry, + ): cosmos.staking.v1beta1.RedelegationEntry; + + /** + * Encodes the specified RedelegationEntry message. Does not implicitly {@link cosmos.staking.v1beta1.RedelegationEntry.verify|verify} messages. + * @param m RedelegationEntry message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode( + m: cosmos.staking.v1beta1.IRedelegationEntry, + w?: $protobuf.Writer, + ): $protobuf.Writer; + + /** + * Decodes a RedelegationEntry message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns RedelegationEntry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode( + r: $protobuf.Reader | Uint8Array, + l?: number, + ): cosmos.staking.v1beta1.RedelegationEntry; + } + + /** Properties of a Redelegation. */ + interface IRedelegation { + /** Redelegation delegatorAddress */ + delegatorAddress?: string | null; + + /** Redelegation validatorSrcAddress */ + validatorSrcAddress?: string | null; + + /** Redelegation validatorDstAddress */ + validatorDstAddress?: string | null; + + /** Redelegation entries */ + entries?: cosmos.staking.v1beta1.IRedelegationEntry[] | null; + } + + /** Represents a Redelegation. */ + class Redelegation implements IRedelegation { + /** + * Constructs a new Redelegation. + * @param [p] Properties to set + */ + constructor(p?: cosmos.staking.v1beta1.IRedelegation); + + /** Redelegation delegatorAddress. */ + public delegatorAddress: string; + + /** Redelegation validatorSrcAddress. */ + public validatorSrcAddress: string; + + /** Redelegation validatorDstAddress. */ + public validatorDstAddress: string; + + /** Redelegation entries. */ + public entries: cosmos.staking.v1beta1.IRedelegationEntry[]; + + /** + * Creates a new Redelegation instance using the specified properties. + * @param [properties] Properties to set + * @returns Redelegation instance + */ + public static create( + properties?: cosmos.staking.v1beta1.IRedelegation, + ): cosmos.staking.v1beta1.Redelegation; + + /** + * Encodes the specified Redelegation message. Does not implicitly {@link cosmos.staking.v1beta1.Redelegation.verify|verify} messages. + * @param m Redelegation message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: cosmos.staking.v1beta1.IRedelegation, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Redelegation message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns Redelegation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode( + r: $protobuf.Reader | Uint8Array, + l?: number, + ): cosmos.staking.v1beta1.Redelegation; + } + + /** Properties of a Params. */ + interface IParams { + /** Params unbondingTime */ + unbondingTime?: google.protobuf.IDuration | null; + + /** Params maxValidators */ + maxValidators?: number | null; + + /** Params maxEntries */ + maxEntries?: number | null; + + /** Params historicalEntries */ + historicalEntries?: number | null; + + /** Params bondDenom */ + bondDenom?: string | null; + } + + /** Represents a Params. */ + class Params implements IParams { + /** + * Constructs a new Params. + * @param [p] Properties to set + */ + constructor(p?: cosmos.staking.v1beta1.IParams); + + /** Params unbondingTime. */ + public unbondingTime?: google.protobuf.IDuration | null; + + /** Params maxValidators. */ + public maxValidators: number; + + /** Params maxEntries. */ + public maxEntries: number; + + /** Params historicalEntries. */ + public historicalEntries: number; + + /** Params bondDenom. */ + public bondDenom: string; + + /** + * Creates a new Params instance using the specified properties. + * @param [properties] Properties to set + * @returns Params instance + */ + public static create(properties?: cosmos.staking.v1beta1.IParams): cosmos.staking.v1beta1.Params; + + /** + * Encodes the specified Params message. Does not implicitly {@link cosmos.staking.v1beta1.Params.verify|verify} messages. + * @param m Params message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: cosmos.staking.v1beta1.IParams, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Params message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns Params + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): cosmos.staking.v1beta1.Params; + } + + /** Properties of a DelegationResponse. */ + interface IDelegationResponse { + /** DelegationResponse delegation */ + delegation?: cosmos.staking.v1beta1.IDelegation | null; + + /** DelegationResponse balance */ + balance?: cosmos.base.v1beta1.ICoin | null; + } + + /** Represents a DelegationResponse. */ + class DelegationResponse implements IDelegationResponse { + /** + * Constructs a new DelegationResponse. + * @param [p] Properties to set + */ + constructor(p?: cosmos.staking.v1beta1.IDelegationResponse); + + /** DelegationResponse delegation. */ + public delegation?: cosmos.staking.v1beta1.IDelegation | null; + + /** DelegationResponse balance. */ + public balance?: cosmos.base.v1beta1.ICoin | null; + + /** + * Creates a new DelegationResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns DelegationResponse instance + */ + public static create( + properties?: cosmos.staking.v1beta1.IDelegationResponse, + ): cosmos.staking.v1beta1.DelegationResponse; + + /** + * Encodes the specified DelegationResponse message. Does not implicitly {@link cosmos.staking.v1beta1.DelegationResponse.verify|verify} messages. + * @param m DelegationResponse message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode( + m: cosmos.staking.v1beta1.IDelegationResponse, + w?: $protobuf.Writer, + ): $protobuf.Writer; + + /** + * Decodes a DelegationResponse message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns DelegationResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode( + r: $protobuf.Reader | Uint8Array, + l?: number, + ): cosmos.staking.v1beta1.DelegationResponse; + } + + /** Properties of a RedelegationEntryResponse. */ + interface IRedelegationEntryResponse { + /** RedelegationEntryResponse redelegationEntry */ + redelegationEntry?: cosmos.staking.v1beta1.IRedelegationEntry | null; + + /** RedelegationEntryResponse balance */ + balance?: string | null; + } + + /** Represents a RedelegationEntryResponse. */ + class RedelegationEntryResponse implements IRedelegationEntryResponse { + /** + * Constructs a new RedelegationEntryResponse. + * @param [p] Properties to set + */ + constructor(p?: cosmos.staking.v1beta1.IRedelegationEntryResponse); + + /** RedelegationEntryResponse redelegationEntry. */ + public redelegationEntry?: cosmos.staking.v1beta1.IRedelegationEntry | null; + + /** RedelegationEntryResponse balance. */ + public balance: string; + + /** + * Creates a new RedelegationEntryResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns RedelegationEntryResponse instance + */ + public static create( + properties?: cosmos.staking.v1beta1.IRedelegationEntryResponse, + ): cosmos.staking.v1beta1.RedelegationEntryResponse; + + /** + * Encodes the specified RedelegationEntryResponse message. Does not implicitly {@link cosmos.staking.v1beta1.RedelegationEntryResponse.verify|verify} messages. + * @param m RedelegationEntryResponse message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode( + m: cosmos.staking.v1beta1.IRedelegationEntryResponse, + w?: $protobuf.Writer, + ): $protobuf.Writer; + + /** + * Decodes a RedelegationEntryResponse message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns RedelegationEntryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode( + r: $protobuf.Reader | Uint8Array, + l?: number, + ): cosmos.staking.v1beta1.RedelegationEntryResponse; + } + + /** Properties of a RedelegationResponse. */ + interface IRedelegationResponse { + /** RedelegationResponse redelegation */ + redelegation?: cosmos.staking.v1beta1.IRedelegation | null; + + /** RedelegationResponse entries */ + entries?: cosmos.staking.v1beta1.IRedelegationEntryResponse[] | null; + } + + /** Represents a RedelegationResponse. */ + class RedelegationResponse implements IRedelegationResponse { + /** + * Constructs a new RedelegationResponse. + * @param [p] Properties to set + */ + constructor(p?: cosmos.staking.v1beta1.IRedelegationResponse); + + /** RedelegationResponse redelegation. */ + public redelegation?: cosmos.staking.v1beta1.IRedelegation | null; + + /** RedelegationResponse entries. */ + public entries: cosmos.staking.v1beta1.IRedelegationEntryResponse[]; + + /** + * Creates a new RedelegationResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns RedelegationResponse instance + */ + public static create( + properties?: cosmos.staking.v1beta1.IRedelegationResponse, + ): cosmos.staking.v1beta1.RedelegationResponse; + + /** + * Encodes the specified RedelegationResponse message. Does not implicitly {@link cosmos.staking.v1beta1.RedelegationResponse.verify|verify} messages. + * @param m RedelegationResponse message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode( + m: cosmos.staking.v1beta1.IRedelegationResponse, + w?: $protobuf.Writer, + ): $protobuf.Writer; + + /** + * Decodes a RedelegationResponse message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns RedelegationResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode( + r: $protobuf.Reader | Uint8Array, + l?: number, + ): cosmos.staking.v1beta1.RedelegationResponse; + } + + /** Properties of a Pool. */ + interface IPool { + /** Pool notBondedTokens */ + notBondedTokens?: string | null; + + /** Pool bondedTokens */ + bondedTokens?: string | null; + } + + /** Represents a Pool. */ + class Pool implements IPool { + /** + * Constructs a new Pool. + * @param [p] Properties to set + */ + constructor(p?: cosmos.staking.v1beta1.IPool); + + /** Pool notBondedTokens. */ + public notBondedTokens: string; + + /** Pool bondedTokens. */ + public bondedTokens: string; + + /** + * Creates a new Pool instance using the specified properties. + * @param [properties] Properties to set + * @returns Pool instance + */ + public static create(properties?: cosmos.staking.v1beta1.IPool): cosmos.staking.v1beta1.Pool; + + /** + * Encodes the specified Pool message. Does not implicitly {@link cosmos.staking.v1beta1.Pool.verify|verify} messages. + * @param m Pool message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: cosmos.staking.v1beta1.IPool, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Pool message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns Pool + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): cosmos.staking.v1beta1.Pool; + } + + /** Properties of a MsgCreateValidator. */ + interface IMsgCreateValidator { + /** MsgCreateValidator description */ + description?: cosmos.staking.v1beta1.IDescription | null; + + /** MsgCreateValidator commission */ + commission?: cosmos.staking.v1beta1.ICommissionRates | null; + + /** MsgCreateValidator minSelfDelegation */ + minSelfDelegation?: string | null; + + /** MsgCreateValidator delegatorAddress */ + delegatorAddress?: string | null; + + /** MsgCreateValidator validatorAddress */ + validatorAddress?: string | null; + + /** MsgCreateValidator pubkey */ + pubkey?: string | null; + + /** MsgCreateValidator value */ + value?: cosmos.base.v1beta1.ICoin | null; + } + + /** Represents a MsgCreateValidator. */ + class MsgCreateValidator implements IMsgCreateValidator { + /** + * Constructs a new MsgCreateValidator. + * @param [p] Properties to set + */ + constructor(p?: cosmos.staking.v1beta1.IMsgCreateValidator); + + /** MsgCreateValidator description. */ + public description?: cosmos.staking.v1beta1.IDescription | null; + + /** MsgCreateValidator commission. */ + public commission?: cosmos.staking.v1beta1.ICommissionRates | null; + + /** MsgCreateValidator minSelfDelegation. */ + public minSelfDelegation: string; + + /** MsgCreateValidator delegatorAddress. */ + public delegatorAddress: string; + + /** MsgCreateValidator validatorAddress. */ + public validatorAddress: string; + + /** MsgCreateValidator pubkey. */ + public pubkey: string; + + /** MsgCreateValidator value. */ + public value?: cosmos.base.v1beta1.ICoin | null; + + /** + * Creates a new MsgCreateValidator instance using the specified properties. + * @param [properties] Properties to set + * @returns MsgCreateValidator instance + */ + public static create( + properties?: cosmos.staking.v1beta1.IMsgCreateValidator, + ): cosmos.staking.v1beta1.MsgCreateValidator; + + /** + * Encodes the specified MsgCreateValidator message. Does not implicitly {@link cosmos.staking.v1beta1.MsgCreateValidator.verify|verify} messages. + * @param m MsgCreateValidator message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode( + m: cosmos.staking.v1beta1.IMsgCreateValidator, + w?: $protobuf.Writer, + ): $protobuf.Writer; + + /** + * Decodes a MsgCreateValidator message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns MsgCreateValidator + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode( + r: $protobuf.Reader | Uint8Array, + l?: number, + ): cosmos.staking.v1beta1.MsgCreateValidator; + } + + /** Properties of a MsgEditValidator. */ + interface IMsgEditValidator { + /** MsgEditValidator description */ + description?: cosmos.staking.v1beta1.IDescription | null; + + /** MsgEditValidator validatorAddress */ + validatorAddress?: string | null; + + /** MsgEditValidator commissionRate */ + commissionRate?: string | null; + + /** MsgEditValidator minSelfDelegation */ + minSelfDelegation?: string | null; + } + + /** Represents a MsgEditValidator. */ + class MsgEditValidator implements IMsgEditValidator { + /** + * Constructs a new MsgEditValidator. + * @param [p] Properties to set + */ + constructor(p?: cosmos.staking.v1beta1.IMsgEditValidator); + + /** MsgEditValidator description. */ + public description?: cosmos.staking.v1beta1.IDescription | null; + + /** MsgEditValidator validatorAddress. */ + public validatorAddress: string; + + /** MsgEditValidator commissionRate. */ + public commissionRate: string; + + /** MsgEditValidator minSelfDelegation. */ + public minSelfDelegation: string; + + /** + * Creates a new MsgEditValidator instance using the specified properties. + * @param [properties] Properties to set + * @returns MsgEditValidator instance + */ + public static create( + properties?: cosmos.staking.v1beta1.IMsgEditValidator, + ): cosmos.staking.v1beta1.MsgEditValidator; + + /** + * Encodes the specified MsgEditValidator message. Does not implicitly {@link cosmos.staking.v1beta1.MsgEditValidator.verify|verify} messages. + * @param m MsgEditValidator message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode( + m: cosmos.staking.v1beta1.IMsgEditValidator, + w?: $protobuf.Writer, + ): $protobuf.Writer; + + /** + * Decodes a MsgEditValidator message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns MsgEditValidator + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode( + r: $protobuf.Reader | Uint8Array, + l?: number, + ): cosmos.staking.v1beta1.MsgEditValidator; + } + + /** Properties of a MsgDelegate. */ + interface IMsgDelegate { + /** MsgDelegate delegatorAddress */ + delegatorAddress?: string | null; + + /** MsgDelegate validatorAddress */ + validatorAddress?: string | null; + + /** MsgDelegate amount */ + amount?: cosmos.base.v1beta1.ICoin | null; + } + + /** Represents a MsgDelegate. */ + class MsgDelegate implements IMsgDelegate { + /** + * Constructs a new MsgDelegate. + * @param [p] Properties to set + */ + constructor(p?: cosmos.staking.v1beta1.IMsgDelegate); + + /** MsgDelegate delegatorAddress. */ + public delegatorAddress: string; + + /** MsgDelegate validatorAddress. */ + public validatorAddress: string; + + /** MsgDelegate amount. */ + public amount?: cosmos.base.v1beta1.ICoin | null; + + /** + * Creates a new MsgDelegate instance using the specified properties. + * @param [properties] Properties to set + * @returns MsgDelegate instance + */ + public static create( + properties?: cosmos.staking.v1beta1.IMsgDelegate, + ): cosmos.staking.v1beta1.MsgDelegate; + + /** + * Encodes the specified MsgDelegate message. Does not implicitly {@link cosmos.staking.v1beta1.MsgDelegate.verify|verify} messages. + * @param m MsgDelegate message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: cosmos.staking.v1beta1.IMsgDelegate, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MsgDelegate message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns MsgDelegate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode( + r: $protobuf.Reader | Uint8Array, + l?: number, + ): cosmos.staking.v1beta1.MsgDelegate; + } + + /** Properties of a MsgBeginRedelegate. */ + interface IMsgBeginRedelegate { + /** MsgBeginRedelegate delegatorAddress */ + delegatorAddress?: string | null; + + /** MsgBeginRedelegate validatorSrcAddress */ + validatorSrcAddress?: string | null; + + /** MsgBeginRedelegate validatorDstAddress */ + validatorDstAddress?: string | null; + + /** MsgBeginRedelegate amount */ + amount?: cosmos.base.v1beta1.ICoin | null; + } + + /** Represents a MsgBeginRedelegate. */ + class MsgBeginRedelegate implements IMsgBeginRedelegate { + /** + * Constructs a new MsgBeginRedelegate. + * @param [p] Properties to set + */ + constructor(p?: cosmos.staking.v1beta1.IMsgBeginRedelegate); + + /** MsgBeginRedelegate delegatorAddress. */ + public delegatorAddress: string; + + /** MsgBeginRedelegate validatorSrcAddress. */ + public validatorSrcAddress: string; + + /** MsgBeginRedelegate validatorDstAddress. */ + public validatorDstAddress: string; + + /** MsgBeginRedelegate amount. */ + public amount?: cosmos.base.v1beta1.ICoin | null; + + /** + * Creates a new MsgBeginRedelegate instance using the specified properties. + * @param [properties] Properties to set + * @returns MsgBeginRedelegate instance + */ + public static create( + properties?: cosmos.staking.v1beta1.IMsgBeginRedelegate, + ): cosmos.staking.v1beta1.MsgBeginRedelegate; + + /** + * Encodes the specified MsgBeginRedelegate message. Does not implicitly {@link cosmos.staking.v1beta1.MsgBeginRedelegate.verify|verify} messages. + * @param m MsgBeginRedelegate message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode( + m: cosmos.staking.v1beta1.IMsgBeginRedelegate, + w?: $protobuf.Writer, + ): $protobuf.Writer; + + /** + * Decodes a MsgBeginRedelegate message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns MsgBeginRedelegate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode( + r: $protobuf.Reader | Uint8Array, + l?: number, + ): cosmos.staking.v1beta1.MsgBeginRedelegate; + } + + /** Properties of a MsgUndelegate. */ + interface IMsgUndelegate { + /** MsgUndelegate delegatorAddress */ + delegatorAddress?: string | null; + + /** MsgUndelegate validatorAddress */ + validatorAddress?: string | null; + + /** MsgUndelegate amount */ + amount?: cosmos.base.v1beta1.ICoin | null; + } + + /** Represents a MsgUndelegate. */ + class MsgUndelegate implements IMsgUndelegate { + /** + * Constructs a new MsgUndelegate. + * @param [p] Properties to set + */ + constructor(p?: cosmos.staking.v1beta1.IMsgUndelegate); + + /** MsgUndelegate delegatorAddress. */ + public delegatorAddress: string; + + /** MsgUndelegate validatorAddress. */ + public validatorAddress: string; + + /** MsgUndelegate amount. */ + public amount?: cosmos.base.v1beta1.ICoin | null; + + /** + * Creates a new MsgUndelegate instance using the specified properties. + * @param [properties] Properties to set + * @returns MsgUndelegate instance + */ + public static create( + properties?: cosmos.staking.v1beta1.IMsgUndelegate, + ): cosmos.staking.v1beta1.MsgUndelegate; + + /** + * Encodes the specified MsgUndelegate message. Does not implicitly {@link cosmos.staking.v1beta1.MsgUndelegate.verify|verify} messages. + * @param m MsgUndelegate message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode( + m: cosmos.staking.v1beta1.IMsgUndelegate, + w?: $protobuf.Writer, + ): $protobuf.Writer; + + /** + * Decodes a MsgUndelegate message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns MsgUndelegate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode( + r: $protobuf.Reader | Uint8Array, + l?: number, + ): cosmos.staking.v1beta1.MsgUndelegate; + } + } + } + /** Namespace tx. */ namespace tx { /** Namespace signing. */ @@ -4358,6 +5916,104 @@ export namespace google { ): google.protobuf.GeneratedCodeInfo.Annotation; } } + + /** Properties of a Timestamp. */ + interface ITimestamp { + /** Timestamp seconds */ + seconds?: Long | null; + + /** Timestamp nanos */ + nanos?: number | null; + } + + /** Represents a Timestamp. */ + class Timestamp implements ITimestamp { + /** + * Constructs a new Timestamp. + * @param [p] Properties to set + */ + constructor(p?: google.protobuf.ITimestamp); + + /** Timestamp seconds. */ + public seconds: Long; + + /** Timestamp nanos. */ + public nanos: number; + + /** + * Creates a new Timestamp instance using the specified properties. + * @param [properties] Properties to set + * @returns Timestamp instance + */ + public static create(properties?: google.protobuf.ITimestamp): google.protobuf.Timestamp; + + /** + * Encodes the specified Timestamp message. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. + * @param m Timestamp message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: google.protobuf.ITimestamp, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Timestamp message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns Timestamp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): google.protobuf.Timestamp; + } + + /** Properties of a Duration. */ + interface IDuration { + /** Duration seconds */ + seconds?: Long | null; + + /** Duration nanos */ + nanos?: number | null; + } + + /** Represents a Duration. */ + class Duration implements IDuration { + /** + * Constructs a new Duration. + * @param [p] Properties to set + */ + constructor(p?: google.protobuf.IDuration); + + /** Duration seconds. */ + public seconds: Long; + + /** Duration nanos. */ + public nanos: number; + + /** + * Creates a new Duration instance using the specified properties. + * @param [properties] Properties to set + * @returns Duration instance + */ + public static create(properties?: google.protobuf.IDuration): google.protobuf.Duration; + + /** + * Encodes the specified Duration message. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * @param m Duration message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: google.protobuf.IDuration, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Duration message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns Duration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): google.protobuf.Duration; + } } /** Namespace api. */ @@ -9880,6 +11536,52 @@ export namespace ibc { export namespace tendermint { /** Namespace crypto. */ namespace crypto { + /** Properties of a PublicKey. */ + interface IPublicKey { + /** PublicKey ed25519 */ + ed25519?: Uint8Array | null; + } + + /** Represents a PublicKey. */ + class PublicKey implements IPublicKey { + /** + * Constructs a new PublicKey. + * @param [p] Properties to set + */ + constructor(p?: tendermint.crypto.IPublicKey); + + /** PublicKey ed25519. */ + public ed25519: Uint8Array; + + /** PublicKey sum. */ + public sum?: "ed25519"; + + /** + * Creates a new PublicKey instance using the specified properties. + * @param [properties] Properties to set + * @returns PublicKey instance + */ + public static create(properties?: tendermint.crypto.IPublicKey): tendermint.crypto.PublicKey; + + /** + * Encodes the specified PublicKey message. Does not implicitly {@link tendermint.crypto.PublicKey.verify|verify} messages. + * @param m PublicKey message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: tendermint.crypto.IPublicKey, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PublicKey message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns PublicKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): tendermint.crypto.PublicKey; + } + /** Properties of a Proof. */ interface IProof { /** Proof total */ @@ -10143,4 +11845,1179 @@ export namespace tendermint { public static decode(r: $protobuf.Reader | Uint8Array, l?: number): tendermint.crypto.ProofOps; } } + + /** Namespace libs. */ + namespace libs { + /** Namespace bits. */ + namespace bits { + /** Properties of a BitArray. */ + interface IBitArray { + /** BitArray bits */ + bits?: Long | null; + + /** BitArray elems */ + elems?: Long[] | null; + } + + /** Represents a BitArray. */ + class BitArray implements IBitArray { + /** + * Constructs a new BitArray. + * @param [p] Properties to set + */ + constructor(p?: tendermint.libs.bits.IBitArray); + + /** BitArray bits. */ + public bits: Long; + + /** BitArray elems. */ + public elems: Long[]; + + /** + * Creates a new BitArray instance using the specified properties. + * @param [properties] Properties to set + * @returns BitArray instance + */ + public static create(properties?: tendermint.libs.bits.IBitArray): tendermint.libs.bits.BitArray; + + /** + * Encodes the specified BitArray message. Does not implicitly {@link tendermint.libs.bits.BitArray.verify|verify} messages. + * @param m BitArray message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: tendermint.libs.bits.IBitArray, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BitArray message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns BitArray + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): tendermint.libs.bits.BitArray; + } + } + } + + /** Namespace types. */ + namespace types { + /** BlockIDFlag enum. */ + enum BlockIDFlag { + BLOCK_ID_FLAG_UNKNOWN = 0, + BLOCK_ID_FLAG_ABSENT = 1, + BLOCK_ID_FLAG_COMMIT = 2, + BLOCK_ID_FLAG_NIL = 3, + } + + /** SignedMsgType enum. */ + enum SignedMsgType { + SIGNED_MSG_TYPE_UNKNOWN = 0, + SIGNED_MSG_TYPE_PREVOTE = 1, + SIGNED_MSG_TYPE_PRECOMMIT = 2, + SIGNED_MSG_TYPE_PROPOSAL = 32, + } + + /** Properties of a PartSetHeader. */ + interface IPartSetHeader { + /** PartSetHeader total */ + total?: number | null; + + /** PartSetHeader hash */ + hash?: Uint8Array | null; + } + + /** Represents a PartSetHeader. */ + class PartSetHeader implements IPartSetHeader { + /** + * Constructs a new PartSetHeader. + * @param [p] Properties to set + */ + constructor(p?: tendermint.types.IPartSetHeader); + + /** PartSetHeader total. */ + public total: number; + + /** PartSetHeader hash. */ + public hash: Uint8Array; + + /** + * Creates a new PartSetHeader instance using the specified properties. + * @param [properties] Properties to set + * @returns PartSetHeader instance + */ + public static create(properties?: tendermint.types.IPartSetHeader): tendermint.types.PartSetHeader; + + /** + * Encodes the specified PartSetHeader message. Does not implicitly {@link tendermint.types.PartSetHeader.verify|verify} messages. + * @param m PartSetHeader message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: tendermint.types.IPartSetHeader, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PartSetHeader message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns PartSetHeader + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): tendermint.types.PartSetHeader; + } + + /** Properties of a Part. */ + interface IPart { + /** Part index */ + index?: number | null; + + /** Part bytes */ + bytes?: Uint8Array | null; + + /** Part proof */ + proof?: tendermint.crypto.IProof | null; + } + + /** Represents a Part. */ + class Part implements IPart { + /** + * Constructs a new Part. + * @param [p] Properties to set + */ + constructor(p?: tendermint.types.IPart); + + /** Part index. */ + public index: number; + + /** Part bytes. */ + public bytes: Uint8Array; + + /** Part proof. */ + public proof?: tendermint.crypto.IProof | null; + + /** + * Creates a new Part instance using the specified properties. + * @param [properties] Properties to set + * @returns Part instance + */ + public static create(properties?: tendermint.types.IPart): tendermint.types.Part; + + /** + * Encodes the specified Part message. Does not implicitly {@link tendermint.types.Part.verify|verify} messages. + * @param m Part message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: tendermint.types.IPart, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Part message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns Part + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): tendermint.types.Part; + } + + /** Properties of a BlockID. */ + interface IBlockID { + /** BlockID hash */ + hash?: Uint8Array | null; + + /** BlockID partSetHeader */ + partSetHeader?: tendermint.types.IPartSetHeader | null; + } + + /** Represents a BlockID. */ + class BlockID implements IBlockID { + /** + * Constructs a new BlockID. + * @param [p] Properties to set + */ + constructor(p?: tendermint.types.IBlockID); + + /** BlockID hash. */ + public hash: Uint8Array; + + /** BlockID partSetHeader. */ + public partSetHeader?: tendermint.types.IPartSetHeader | null; + + /** + * Creates a new BlockID instance using the specified properties. + * @param [properties] Properties to set + * @returns BlockID instance + */ + public static create(properties?: tendermint.types.IBlockID): tendermint.types.BlockID; + + /** + * Encodes the specified BlockID message. Does not implicitly {@link tendermint.types.BlockID.verify|verify} messages. + * @param m BlockID message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: tendermint.types.IBlockID, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BlockID message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns BlockID + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): tendermint.types.BlockID; + } + + /** Properties of a Header. */ + interface IHeader { + /** Header version */ + version?: tendermint.version.IConsensus | null; + + /** Header chainId */ + chainId?: string | null; + + /** Header height */ + height?: Long | null; + + /** Header time */ + time?: google.protobuf.ITimestamp | null; + + /** Header lastBlockId */ + lastBlockId?: tendermint.types.IBlockID | null; + + /** Header lastCommitHash */ + lastCommitHash?: Uint8Array | null; + + /** Header dataHash */ + dataHash?: Uint8Array | null; + + /** Header validatorsHash */ + validatorsHash?: Uint8Array | null; + + /** Header nextValidatorsHash */ + nextValidatorsHash?: Uint8Array | null; + + /** Header consensusHash */ + consensusHash?: Uint8Array | null; + + /** Header appHash */ + appHash?: Uint8Array | null; + + /** Header lastResultsHash */ + lastResultsHash?: Uint8Array | null; + + /** Header evidenceHash */ + evidenceHash?: Uint8Array | null; + + /** Header proposerAddress */ + proposerAddress?: Uint8Array | null; + } + + /** Represents a Header. */ + class Header implements IHeader { + /** + * Constructs a new Header. + * @param [p] Properties to set + */ + constructor(p?: tendermint.types.IHeader); + + /** Header version. */ + public version?: tendermint.version.IConsensus | null; + + /** Header chainId. */ + public chainId: string; + + /** Header height. */ + public height: Long; + + /** Header time. */ + public time?: google.protobuf.ITimestamp | null; + + /** Header lastBlockId. */ + public lastBlockId?: tendermint.types.IBlockID | null; + + /** Header lastCommitHash. */ + public lastCommitHash: Uint8Array; + + /** Header dataHash. */ + public dataHash: Uint8Array; + + /** Header validatorsHash. */ + public validatorsHash: Uint8Array; + + /** Header nextValidatorsHash. */ + public nextValidatorsHash: Uint8Array; + + /** Header consensusHash. */ + public consensusHash: Uint8Array; + + /** Header appHash. */ + public appHash: Uint8Array; + + /** Header lastResultsHash. */ + public lastResultsHash: Uint8Array; + + /** Header evidenceHash. */ + public evidenceHash: Uint8Array; + + /** Header proposerAddress. */ + public proposerAddress: Uint8Array; + + /** + * Creates a new Header instance using the specified properties. + * @param [properties] Properties to set + * @returns Header instance + */ + public static create(properties?: tendermint.types.IHeader): tendermint.types.Header; + + /** + * Encodes the specified Header message. Does not implicitly {@link tendermint.types.Header.verify|verify} messages. + * @param m Header message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: tendermint.types.IHeader, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Header message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns Header + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): tendermint.types.Header; + } + + /** Properties of a Data. */ + interface IData { + /** Data txs */ + txs?: Uint8Array[] | null; + + /** Data hash */ + hash?: Uint8Array | null; + } + + /** Represents a Data. */ + class Data implements IData { + /** + * Constructs a new Data. + * @param [p] Properties to set + */ + constructor(p?: tendermint.types.IData); + + /** Data txs. */ + public txs: Uint8Array[]; + + /** Data hash. */ + public hash: Uint8Array; + + /** + * Creates a new Data instance using the specified properties. + * @param [properties] Properties to set + * @returns Data instance + */ + public static create(properties?: tendermint.types.IData): tendermint.types.Data; + + /** + * Encodes the specified Data message. Does not implicitly {@link tendermint.types.Data.verify|verify} messages. + * @param m Data message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: tendermint.types.IData, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Data message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns Data + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): tendermint.types.Data; + } + + /** Properties of a Vote. */ + interface IVote { + /** Vote type */ + type?: tendermint.types.SignedMsgType | null; + + /** Vote height */ + height?: Long | null; + + /** Vote round */ + round?: number | null; + + /** Vote blockId */ + blockId?: tendermint.types.IBlockID | null; + + /** Vote timestamp */ + timestamp?: google.protobuf.ITimestamp | null; + + /** Vote validatorAddress */ + validatorAddress?: Uint8Array | null; + + /** Vote validatorIndex */ + validatorIndex?: number | null; + + /** Vote signature */ + signature?: Uint8Array | null; + } + + /** Represents a Vote. */ + class Vote implements IVote { + /** + * Constructs a new Vote. + * @param [p] Properties to set + */ + constructor(p?: tendermint.types.IVote); + + /** Vote type. */ + public type: tendermint.types.SignedMsgType; + + /** Vote height. */ + public height: Long; + + /** Vote round. */ + public round: number; + + /** Vote blockId. */ + public blockId?: tendermint.types.IBlockID | null; + + /** Vote timestamp. */ + public timestamp?: google.protobuf.ITimestamp | null; + + /** Vote validatorAddress. */ + public validatorAddress: Uint8Array; + + /** Vote validatorIndex. */ + public validatorIndex: number; + + /** Vote signature. */ + public signature: Uint8Array; + + /** + * Creates a new Vote instance using the specified properties. + * @param [properties] Properties to set + * @returns Vote instance + */ + public static create(properties?: tendermint.types.IVote): tendermint.types.Vote; + + /** + * Encodes the specified Vote message. Does not implicitly {@link tendermint.types.Vote.verify|verify} messages. + * @param m Vote message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: tendermint.types.IVote, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Vote message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns Vote + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): tendermint.types.Vote; + } + + /** Properties of a Commit. */ + interface ICommit { + /** Commit height */ + height?: Long | null; + + /** Commit round */ + round?: number | null; + + /** Commit blockId */ + blockId?: tendermint.types.IBlockID | null; + + /** Commit signatures */ + signatures?: tendermint.types.ICommitSig[] | null; + + /** Commit hash */ + hash?: Uint8Array | null; + + /** Commit bitArray */ + bitArray?: tendermint.libs.bits.IBitArray | null; + } + + /** Represents a Commit. */ + class Commit implements ICommit { + /** + * Constructs a new Commit. + * @param [p] Properties to set + */ + constructor(p?: tendermint.types.ICommit); + + /** Commit height. */ + public height: Long; + + /** Commit round. */ + public round: number; + + /** Commit blockId. */ + public blockId?: tendermint.types.IBlockID | null; + + /** Commit signatures. */ + public signatures: tendermint.types.ICommitSig[]; + + /** Commit hash. */ + public hash: Uint8Array; + + /** Commit bitArray. */ + public bitArray?: tendermint.libs.bits.IBitArray | null; + + /** + * Creates a new Commit instance using the specified properties. + * @param [properties] Properties to set + * @returns Commit instance + */ + public static create(properties?: tendermint.types.ICommit): tendermint.types.Commit; + + /** + * Encodes the specified Commit message. Does not implicitly {@link tendermint.types.Commit.verify|verify} messages. + * @param m Commit message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: tendermint.types.ICommit, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Commit message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns Commit + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): tendermint.types.Commit; + } + + /** Properties of a CommitSig. */ + interface ICommitSig { + /** CommitSig blockIdFlag */ + blockIdFlag?: tendermint.types.BlockIDFlag | null; + + /** CommitSig validatorAddress */ + validatorAddress?: Uint8Array | null; + + /** CommitSig timestamp */ + timestamp?: google.protobuf.ITimestamp | null; + + /** CommitSig signature */ + signature?: Uint8Array | null; + } + + /** Represents a CommitSig. */ + class CommitSig implements ICommitSig { + /** + * Constructs a new CommitSig. + * @param [p] Properties to set + */ + constructor(p?: tendermint.types.ICommitSig); + + /** CommitSig blockIdFlag. */ + public blockIdFlag: tendermint.types.BlockIDFlag; + + /** CommitSig validatorAddress. */ + public validatorAddress: Uint8Array; + + /** CommitSig timestamp. */ + public timestamp?: google.protobuf.ITimestamp | null; + + /** CommitSig signature. */ + public signature: Uint8Array; + + /** + * Creates a new CommitSig instance using the specified properties. + * @param [properties] Properties to set + * @returns CommitSig instance + */ + public static create(properties?: tendermint.types.ICommitSig): tendermint.types.CommitSig; + + /** + * Encodes the specified CommitSig message. Does not implicitly {@link tendermint.types.CommitSig.verify|verify} messages. + * @param m CommitSig message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: tendermint.types.ICommitSig, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CommitSig message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns CommitSig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): tendermint.types.CommitSig; + } + + /** Properties of a Proposal. */ + interface IProposal { + /** Proposal type */ + type?: tendermint.types.SignedMsgType | null; + + /** Proposal height */ + height?: Long | null; + + /** Proposal round */ + round?: number | null; + + /** Proposal polRound */ + polRound?: number | null; + + /** Proposal blockId */ + blockId?: tendermint.types.IBlockID | null; + + /** Proposal timestamp */ + timestamp?: google.protobuf.ITimestamp | null; + + /** Proposal signature */ + signature?: Uint8Array | null; + } + + /** Represents a Proposal. */ + class Proposal implements IProposal { + /** + * Constructs a new Proposal. + * @param [p] Properties to set + */ + constructor(p?: tendermint.types.IProposal); + + /** Proposal type. */ + public type: tendermint.types.SignedMsgType; + + /** Proposal height. */ + public height: Long; + + /** Proposal round. */ + public round: number; + + /** Proposal polRound. */ + public polRound: number; + + /** Proposal blockId. */ + public blockId?: tendermint.types.IBlockID | null; + + /** Proposal timestamp. */ + public timestamp?: google.protobuf.ITimestamp | null; + + /** Proposal signature. */ + public signature: Uint8Array; + + /** + * Creates a new Proposal instance using the specified properties. + * @param [properties] Properties to set + * @returns Proposal instance + */ + public static create(properties?: tendermint.types.IProposal): tendermint.types.Proposal; + + /** + * Encodes the specified Proposal message. Does not implicitly {@link tendermint.types.Proposal.verify|verify} messages. + * @param m Proposal message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: tendermint.types.IProposal, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Proposal message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns Proposal + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): tendermint.types.Proposal; + } + + /** Properties of a SignedHeader. */ + interface ISignedHeader { + /** SignedHeader header */ + header?: tendermint.types.IHeader | null; + + /** SignedHeader commit */ + commit?: tendermint.types.ICommit | null; + } + + /** Represents a SignedHeader. */ + class SignedHeader implements ISignedHeader { + /** + * Constructs a new SignedHeader. + * @param [p] Properties to set + */ + constructor(p?: tendermint.types.ISignedHeader); + + /** SignedHeader header. */ + public header?: tendermint.types.IHeader | null; + + /** SignedHeader commit. */ + public commit?: tendermint.types.ICommit | null; + + /** + * Creates a new SignedHeader instance using the specified properties. + * @param [properties] Properties to set + * @returns SignedHeader instance + */ + public static create(properties?: tendermint.types.ISignedHeader): tendermint.types.SignedHeader; + + /** + * Encodes the specified SignedHeader message. Does not implicitly {@link tendermint.types.SignedHeader.verify|verify} messages. + * @param m SignedHeader message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: tendermint.types.ISignedHeader, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SignedHeader message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns SignedHeader + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): tendermint.types.SignedHeader; + } + + /** Properties of a LightBlock. */ + interface ILightBlock { + /** LightBlock signedHeader */ + signedHeader?: tendermint.types.ISignedHeader | null; + + /** LightBlock validatorSet */ + validatorSet?: tendermint.types.IValidatorSet | null; + } + + /** Represents a LightBlock. */ + class LightBlock implements ILightBlock { + /** + * Constructs a new LightBlock. + * @param [p] Properties to set + */ + constructor(p?: tendermint.types.ILightBlock); + + /** LightBlock signedHeader. */ + public signedHeader?: tendermint.types.ISignedHeader | null; + + /** LightBlock validatorSet. */ + public validatorSet?: tendermint.types.IValidatorSet | null; + + /** + * Creates a new LightBlock instance using the specified properties. + * @param [properties] Properties to set + * @returns LightBlock instance + */ + public static create(properties?: tendermint.types.ILightBlock): tendermint.types.LightBlock; + + /** + * Encodes the specified LightBlock message. Does not implicitly {@link tendermint.types.LightBlock.verify|verify} messages. + * @param m LightBlock message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: tendermint.types.ILightBlock, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LightBlock message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns LightBlock + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): tendermint.types.LightBlock; + } + + /** Properties of a BlockMeta. */ + interface IBlockMeta { + /** BlockMeta blockId */ + blockId?: tendermint.types.IBlockID | null; + + /** BlockMeta blockSize */ + blockSize?: Long | null; + + /** BlockMeta header */ + header?: tendermint.types.IHeader | null; + + /** BlockMeta numTxs */ + numTxs?: Long | null; + } + + /** Represents a BlockMeta. */ + class BlockMeta implements IBlockMeta { + /** + * Constructs a new BlockMeta. + * @param [p] Properties to set + */ + constructor(p?: tendermint.types.IBlockMeta); + + /** BlockMeta blockId. */ + public blockId?: tendermint.types.IBlockID | null; + + /** BlockMeta blockSize. */ + public blockSize: Long; + + /** BlockMeta header. */ + public header?: tendermint.types.IHeader | null; + + /** BlockMeta numTxs. */ + public numTxs: Long; + + /** + * Creates a new BlockMeta instance using the specified properties. + * @param [properties] Properties to set + * @returns BlockMeta instance + */ + public static create(properties?: tendermint.types.IBlockMeta): tendermint.types.BlockMeta; + + /** + * Encodes the specified BlockMeta message. Does not implicitly {@link tendermint.types.BlockMeta.verify|verify} messages. + * @param m BlockMeta message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: tendermint.types.IBlockMeta, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BlockMeta message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns BlockMeta + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): tendermint.types.BlockMeta; + } + + /** Properties of a TxProof. */ + interface ITxProof { + /** TxProof rootHash */ + rootHash?: Uint8Array | null; + + /** TxProof data */ + data?: Uint8Array | null; + + /** TxProof proof */ + proof?: tendermint.crypto.IProof | null; + } + + /** Represents a TxProof. */ + class TxProof implements ITxProof { + /** + * Constructs a new TxProof. + * @param [p] Properties to set + */ + constructor(p?: tendermint.types.ITxProof); + + /** TxProof rootHash. */ + public rootHash: Uint8Array; + + /** TxProof data. */ + public data: Uint8Array; + + /** TxProof proof. */ + public proof?: tendermint.crypto.IProof | null; + + /** + * Creates a new TxProof instance using the specified properties. + * @param [properties] Properties to set + * @returns TxProof instance + */ + public static create(properties?: tendermint.types.ITxProof): tendermint.types.TxProof; + + /** + * Encodes the specified TxProof message. Does not implicitly {@link tendermint.types.TxProof.verify|verify} messages. + * @param m TxProof message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: tendermint.types.ITxProof, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TxProof message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns TxProof + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): tendermint.types.TxProof; + } + + /** Properties of a ValidatorSet. */ + interface IValidatorSet { + /** ValidatorSet validators */ + validators?: tendermint.types.IValidator[] | null; + + /** ValidatorSet proposer */ + proposer?: tendermint.types.IValidator | null; + + /** ValidatorSet totalVotingPower */ + totalVotingPower?: Long | null; + } + + /** Represents a ValidatorSet. */ + class ValidatorSet implements IValidatorSet { + /** + * Constructs a new ValidatorSet. + * @param [p] Properties to set + */ + constructor(p?: tendermint.types.IValidatorSet); + + /** ValidatorSet validators. */ + public validators: tendermint.types.IValidator[]; + + /** ValidatorSet proposer. */ + public proposer?: tendermint.types.IValidator | null; + + /** ValidatorSet totalVotingPower. */ + public totalVotingPower: Long; + + /** + * Creates a new ValidatorSet instance using the specified properties. + * @param [properties] Properties to set + * @returns ValidatorSet instance + */ + public static create(properties?: tendermint.types.IValidatorSet): tendermint.types.ValidatorSet; + + /** + * Encodes the specified ValidatorSet message. Does not implicitly {@link tendermint.types.ValidatorSet.verify|verify} messages. + * @param m ValidatorSet message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: tendermint.types.IValidatorSet, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ValidatorSet message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns ValidatorSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): tendermint.types.ValidatorSet; + } + + /** Properties of a Validator. */ + interface IValidator { + /** Validator address */ + address?: Uint8Array | null; + + /** Validator pubKey */ + pubKey?: tendermint.crypto.IPublicKey | null; + + /** Validator votingPower */ + votingPower?: Long | null; + + /** Validator proposerPriority */ + proposerPriority?: Long | null; + } + + /** Represents a Validator. */ + class Validator implements IValidator { + /** + * Constructs a new Validator. + * @param [p] Properties to set + */ + constructor(p?: tendermint.types.IValidator); + + /** Validator address. */ + public address: Uint8Array; + + /** Validator pubKey. */ + public pubKey?: tendermint.crypto.IPublicKey | null; + + /** Validator votingPower. */ + public votingPower: Long; + + /** Validator proposerPriority. */ + public proposerPriority: Long; + + /** + * Creates a new Validator instance using the specified properties. + * @param [properties] Properties to set + * @returns Validator instance + */ + public static create(properties?: tendermint.types.IValidator): tendermint.types.Validator; + + /** + * Encodes the specified Validator message. Does not implicitly {@link tendermint.types.Validator.verify|verify} messages. + * @param m Validator message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: tendermint.types.IValidator, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Validator message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns Validator + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): tendermint.types.Validator; + } + + /** Properties of a SimpleValidator. */ + interface ISimpleValidator { + /** SimpleValidator pubKey */ + pubKey?: tendermint.crypto.IPublicKey | null; + + /** SimpleValidator votingPower */ + votingPower?: Long | null; + } + + /** Represents a SimpleValidator. */ + class SimpleValidator implements ISimpleValidator { + /** + * Constructs a new SimpleValidator. + * @param [p] Properties to set + */ + constructor(p?: tendermint.types.ISimpleValidator); + + /** SimpleValidator pubKey. */ + public pubKey?: tendermint.crypto.IPublicKey | null; + + /** SimpleValidator votingPower. */ + public votingPower: Long; + + /** + * Creates a new SimpleValidator instance using the specified properties. + * @param [properties] Properties to set + * @returns SimpleValidator instance + */ + public static create(properties?: tendermint.types.ISimpleValidator): tendermint.types.SimpleValidator; + + /** + * Encodes the specified SimpleValidator message. Does not implicitly {@link tendermint.types.SimpleValidator.verify|verify} messages. + * @param m SimpleValidator message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: tendermint.types.ISimpleValidator, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SimpleValidator message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns SimpleValidator + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): tendermint.types.SimpleValidator; + } + } + + /** Namespace version. */ + namespace version { + /** Properties of an App. */ + interface IApp { + /** App protocol */ + protocol?: Long | null; + + /** App software */ + software?: string | null; + } + + /** Represents an App. */ + class App implements IApp { + /** + * Constructs a new App. + * @param [p] Properties to set + */ + constructor(p?: tendermint.version.IApp); + + /** App protocol. */ + public protocol: Long; + + /** App software. */ + public software: string; + + /** + * Creates a new App instance using the specified properties. + * @param [properties] Properties to set + * @returns App instance + */ + public static create(properties?: tendermint.version.IApp): tendermint.version.App; + + /** + * Encodes the specified App message. Does not implicitly {@link tendermint.version.App.verify|verify} messages. + * @param m App message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: tendermint.version.IApp, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an App message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns App + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): tendermint.version.App; + } + + /** Properties of a Consensus. */ + interface IConsensus { + /** Consensus block */ + block?: Long | null; + + /** Consensus app */ + app?: Long | null; + } + + /** Represents a Consensus. */ + class Consensus implements IConsensus { + /** + * Constructs a new Consensus. + * @param [p] Properties to set + */ + constructor(p?: tendermint.version.IConsensus); + + /** Consensus block. */ + public block: Long; + + /** Consensus app. */ + public app: Long; + + /** + * Creates a new Consensus instance using the specified properties. + * @param [properties] Properties to set + * @returns Consensus instance + */ + public static create(properties?: tendermint.version.IConsensus): tendermint.version.Consensus; + + /** + * Encodes the specified Consensus message. Does not implicitly {@link tendermint.version.Consensus.verify|verify} messages. + * @param m Consensus message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: tendermint.version.IConsensus, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Consensus message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns Consensus + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): tendermint.version.Consensus; + } + } } From de1e3d7ce22a87e48bbe6d22a57c0a64bed41841 Mon Sep 17 00:00:00 2001 From: willclarktech Date: Tue, 20 Oct 2020 17:30:09 +0200 Subject: [PATCH 10/28] stargate: Update predefine-proto script for MsgSend --- packages/stargate/scripts/predefine-proto.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/stargate/scripts/predefine-proto.sh b/packages/stargate/scripts/predefine-proto.sh index 72081199..5c05e91c 100755 --- a/packages/stargate/scripts/predefine-proto.sh +++ b/packages/stargate/scripts/predefine-proto.sh @@ -22,7 +22,9 @@ yarn pbjs \ --force-long \ "$COSMOS_PROTO_DIR/auth/v1beta1/auth.proto" \ "$COSMOS_PROTO_DIR/auth/v1beta1/query.proto" \ + "$COSMOS_PROTO_DIR/bank/v1beta1/bank.proto" \ "$COSMOS_PROTO_DIR/bank/v1beta1/query.proto" \ + "$COSMOS_PROTO_DIR/bank/v1beta1/tx.proto" \ "$COSMOS_PROTO_DIR/base/query/v1beta1/pagination.proto" \ "$COSMOS_PROTO_DIR/base/v1beta1/coin.proto" \ "$COSMOS_PROTO_DIR/crypto/multisig/v1beta1/multisig.proto" \ From 2b30e51be683fa1b86b489da3e35111369e9aeb0 Mon Sep 17 00:00:00 2001 From: willclarktech Date: Tue, 20 Oct 2020 17:30:27 +0200 Subject: [PATCH 11/28] stargate: Update codec --- .../src/codec/generated/codecimpl.d.ts | 465 +++++++++++++++++- .../stargate/src/codec/generated/codecimpl.js | 419 +++++++++++++++- .../types/codec/generated/codecimpl.d.ts | 465 +++++++++++++++++- 3 files changed, 1343 insertions(+), 6 deletions(-) diff --git a/packages/stargate/src/codec/generated/codecimpl.d.ts b/packages/stargate/src/codec/generated/codecimpl.d.ts index 346edf38..b72fc457 100644 --- a/packages/stargate/src/codec/generated/codecimpl.d.ts +++ b/packages/stargate/src/codec/generated/codecimpl.d.ts @@ -478,6 +478,361 @@ export namespace cosmos { namespace bank { /** Namespace v1beta1. */ namespace v1beta1 { + /** Properties of a Params. */ + interface IParams { + /** Params sendEnabled */ + sendEnabled?: cosmos.bank.v1beta1.ISendEnabled[] | null; + + /** Params defaultSendEnabled */ + defaultSendEnabled?: boolean | null; + } + + /** Represents a Params. */ + class Params implements IParams { + /** + * Constructs a new Params. + * @param [p] Properties to set + */ + constructor(p?: cosmos.bank.v1beta1.IParams); + + /** Params sendEnabled. */ + public sendEnabled: cosmos.bank.v1beta1.ISendEnabled[]; + + /** Params defaultSendEnabled. */ + public defaultSendEnabled: boolean; + + /** + * Creates a new Params instance using the specified properties. + * @param [properties] Properties to set + * @returns Params instance + */ + public static create(properties?: cosmos.bank.v1beta1.IParams): cosmos.bank.v1beta1.Params; + + /** + * Encodes the specified Params message. Does not implicitly {@link cosmos.bank.v1beta1.Params.verify|verify} messages. + * @param m Params message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: cosmos.bank.v1beta1.IParams, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Params message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns Params + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): cosmos.bank.v1beta1.Params; + } + + /** Properties of a SendEnabled. */ + interface ISendEnabled { + /** SendEnabled denom */ + denom?: string | null; + + /** SendEnabled enabled */ + enabled?: boolean | null; + } + + /** Represents a SendEnabled. */ + class SendEnabled implements ISendEnabled { + /** + * Constructs a new SendEnabled. + * @param [p] Properties to set + */ + constructor(p?: cosmos.bank.v1beta1.ISendEnabled); + + /** SendEnabled denom. */ + public denom: string; + + /** SendEnabled enabled. */ + public enabled: boolean; + + /** + * Creates a new SendEnabled instance using the specified properties. + * @param [properties] Properties to set + * @returns SendEnabled instance + */ + public static create(properties?: cosmos.bank.v1beta1.ISendEnabled): cosmos.bank.v1beta1.SendEnabled; + + /** + * Encodes the specified SendEnabled message. Does not implicitly {@link cosmos.bank.v1beta1.SendEnabled.verify|verify} messages. + * @param m SendEnabled message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: cosmos.bank.v1beta1.ISendEnabled, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SendEnabled message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns SendEnabled + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): cosmos.bank.v1beta1.SendEnabled; + } + + /** Properties of an Input. */ + interface IInput { + /** Input address */ + address?: string | null; + + /** Input coins */ + coins?: cosmos.base.v1beta1.ICoin[] | null; + } + + /** Represents an Input. */ + class Input implements IInput { + /** + * Constructs a new Input. + * @param [p] Properties to set + */ + constructor(p?: cosmos.bank.v1beta1.IInput); + + /** Input address. */ + public address: string; + + /** Input coins. */ + public coins: cosmos.base.v1beta1.ICoin[]; + + /** + * Creates a new Input instance using the specified properties. + * @param [properties] Properties to set + * @returns Input instance + */ + public static create(properties?: cosmos.bank.v1beta1.IInput): cosmos.bank.v1beta1.Input; + + /** + * Encodes the specified Input message. Does not implicitly {@link cosmos.bank.v1beta1.Input.verify|verify} messages. + * @param m Input message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: cosmos.bank.v1beta1.IInput, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Input message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns Input + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): cosmos.bank.v1beta1.Input; + } + + /** Properties of an Output. */ + interface IOutput { + /** Output address */ + address?: string | null; + + /** Output coins */ + coins?: cosmos.base.v1beta1.ICoin[] | null; + } + + /** Represents an Output. */ + class Output implements IOutput { + /** + * Constructs a new Output. + * @param [p] Properties to set + */ + constructor(p?: cosmos.bank.v1beta1.IOutput); + + /** Output address. */ + public address: string; + + /** Output coins. */ + public coins: cosmos.base.v1beta1.ICoin[]; + + /** + * Creates a new Output instance using the specified properties. + * @param [properties] Properties to set + * @returns Output instance + */ + public static create(properties?: cosmos.bank.v1beta1.IOutput): cosmos.bank.v1beta1.Output; + + /** + * Encodes the specified Output message. Does not implicitly {@link cosmos.bank.v1beta1.Output.verify|verify} messages. + * @param m Output message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: cosmos.bank.v1beta1.IOutput, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Output message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns Output + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): cosmos.bank.v1beta1.Output; + } + + /** Properties of a Supply. */ + interface ISupply { + /** Supply total */ + total?: cosmos.base.v1beta1.ICoin[] | null; + } + + /** Represents a Supply. */ + class Supply implements ISupply { + /** + * Constructs a new Supply. + * @param [p] Properties to set + */ + constructor(p?: cosmos.bank.v1beta1.ISupply); + + /** Supply total. */ + public total: cosmos.base.v1beta1.ICoin[]; + + /** + * Creates a new Supply instance using the specified properties. + * @param [properties] Properties to set + * @returns Supply instance + */ + public static create(properties?: cosmos.bank.v1beta1.ISupply): cosmos.bank.v1beta1.Supply; + + /** + * Encodes the specified Supply message. Does not implicitly {@link cosmos.bank.v1beta1.Supply.verify|verify} messages. + * @param m Supply message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: cosmos.bank.v1beta1.ISupply, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Supply message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns Supply + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): cosmos.bank.v1beta1.Supply; + } + + /** Properties of a DenomUnit. */ + interface IDenomUnit { + /** DenomUnit denom */ + denom?: string | null; + + /** DenomUnit exponent */ + exponent?: number | null; + + /** DenomUnit aliases */ + aliases?: string[] | null; + } + + /** Represents a DenomUnit. */ + class DenomUnit implements IDenomUnit { + /** + * Constructs a new DenomUnit. + * @param [p] Properties to set + */ + constructor(p?: cosmos.bank.v1beta1.IDenomUnit); + + /** DenomUnit denom. */ + public denom: string; + + /** DenomUnit exponent. */ + public exponent: number; + + /** DenomUnit aliases. */ + public aliases: string[]; + + /** + * Creates a new DenomUnit instance using the specified properties. + * @param [properties] Properties to set + * @returns DenomUnit instance + */ + public static create(properties?: cosmos.bank.v1beta1.IDenomUnit): cosmos.bank.v1beta1.DenomUnit; + + /** + * Encodes the specified DenomUnit message. Does not implicitly {@link cosmos.bank.v1beta1.DenomUnit.verify|verify} messages. + * @param m DenomUnit message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: cosmos.bank.v1beta1.IDenomUnit, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DenomUnit message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns DenomUnit + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): cosmos.bank.v1beta1.DenomUnit; + } + + /** Properties of a Metadata. */ + interface IMetadata { + /** Metadata description */ + description?: string | null; + + /** Metadata denomUnits */ + denomUnits?: cosmos.bank.v1beta1.IDenomUnit[] | null; + + /** Metadata base */ + base?: string | null; + + /** Metadata display */ + display?: string | null; + } + + /** Represents a Metadata. */ + class Metadata implements IMetadata { + /** + * Constructs a new Metadata. + * @param [p] Properties to set + */ + constructor(p?: cosmos.bank.v1beta1.IMetadata); + + /** Metadata description. */ + public description: string; + + /** Metadata denomUnits. */ + public denomUnits: cosmos.bank.v1beta1.IDenomUnit[]; + + /** Metadata base. */ + public base: string; + + /** Metadata display. */ + public display: string; + + /** + * Creates a new Metadata instance using the specified properties. + * @param [properties] Properties to set + * @returns Metadata instance + */ + public static create(properties?: cosmos.bank.v1beta1.IMetadata): cosmos.bank.v1beta1.Metadata; + + /** + * Encodes the specified Metadata message. Does not implicitly {@link cosmos.bank.v1beta1.Metadata.verify|verify} messages. + * @param m Metadata message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: cosmos.bank.v1beta1.IMetadata, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Metadata message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns Metadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): cosmos.bank.v1beta1.Metadata; + } + /** Represents a Query */ class Query extends $protobuf.rpc.Service { /** @@ -1117,7 +1472,7 @@ export namespace cosmos { /** Properties of a QueryParamsResponse. */ interface IQueryParamsResponse { /** QueryParamsResponse params */ - params?: cosmos.auth.v1beta1.IParams | null; + params?: cosmos.bank.v1beta1.IParams | null; } /** Represents a QueryParamsResponse. */ @@ -1129,7 +1484,7 @@ export namespace cosmos { constructor(p?: cosmos.bank.v1beta1.IQueryParamsResponse); /** QueryParamsResponse params. */ - public params?: cosmos.auth.v1beta1.IParams | null; + public params?: cosmos.bank.v1beta1.IParams | null; /** * Creates a new QueryParamsResponse instance using the specified properties. @@ -1164,6 +1519,112 @@ export namespace cosmos { l?: number, ): cosmos.bank.v1beta1.QueryParamsResponse; } + + /** Properties of a MsgSend. */ + interface IMsgSend { + /** MsgSend fromAddress */ + fromAddress?: string | null; + + /** MsgSend toAddress */ + toAddress?: string | null; + + /** MsgSend amount */ + amount?: cosmos.base.v1beta1.ICoin[] | null; + } + + /** Represents a MsgSend. */ + class MsgSend implements IMsgSend { + /** + * Constructs a new MsgSend. + * @param [p] Properties to set + */ + constructor(p?: cosmos.bank.v1beta1.IMsgSend); + + /** MsgSend fromAddress. */ + public fromAddress: string; + + /** MsgSend toAddress. */ + public toAddress: string; + + /** MsgSend amount. */ + public amount: cosmos.base.v1beta1.ICoin[]; + + /** + * Creates a new MsgSend instance using the specified properties. + * @param [properties] Properties to set + * @returns MsgSend instance + */ + public static create(properties?: cosmos.bank.v1beta1.IMsgSend): cosmos.bank.v1beta1.MsgSend; + + /** + * Encodes the specified MsgSend message. Does not implicitly {@link cosmos.bank.v1beta1.MsgSend.verify|verify} messages. + * @param m MsgSend message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: cosmos.bank.v1beta1.IMsgSend, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MsgSend message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns MsgSend + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): cosmos.bank.v1beta1.MsgSend; + } + + /** Properties of a MsgMultiSend. */ + interface IMsgMultiSend { + /** MsgMultiSend inputs */ + inputs?: cosmos.bank.v1beta1.IInput[] | null; + + /** MsgMultiSend outputs */ + outputs?: cosmos.bank.v1beta1.IOutput[] | null; + } + + /** Represents a MsgMultiSend. */ + class MsgMultiSend implements IMsgMultiSend { + /** + * Constructs a new MsgMultiSend. + * @param [p] Properties to set + */ + constructor(p?: cosmos.bank.v1beta1.IMsgMultiSend); + + /** MsgMultiSend inputs. */ + public inputs: cosmos.bank.v1beta1.IInput[]; + + /** MsgMultiSend outputs. */ + public outputs: cosmos.bank.v1beta1.IOutput[]; + + /** + * Creates a new MsgMultiSend instance using the specified properties. + * @param [properties] Properties to set + * @returns MsgMultiSend instance + */ + public static create( + properties?: cosmos.bank.v1beta1.IMsgMultiSend, + ): cosmos.bank.v1beta1.MsgMultiSend; + + /** + * Encodes the specified MsgMultiSend message. Does not implicitly {@link cosmos.bank.v1beta1.MsgMultiSend.verify|verify} messages. + * @param m MsgMultiSend message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: cosmos.bank.v1beta1.IMsgMultiSend, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MsgMultiSend message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns MsgMultiSend + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): cosmos.bank.v1beta1.MsgMultiSend; + } } } diff --git a/packages/stargate/src/codec/generated/codecimpl.js b/packages/stargate/src/codec/generated/codecimpl.js index 8674615a..295ce45a 100644 --- a/packages/stargate/src/codec/generated/codecimpl.js +++ b/packages/stargate/src/codec/generated/codecimpl.js @@ -349,6 +349,321 @@ exports.cosmos = $root.cosmos = (() => { const bank = {}; bank.v1beta1 = (function () { const v1beta1 = {}; + v1beta1.Params = (function () { + function Params(p) { + this.sendEnabled = []; + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + Params.prototype.sendEnabled = $util.emptyArray; + Params.prototype.defaultSendEnabled = false; + Params.create = function create(properties) { + return new Params(properties); + }; + Params.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.sendEnabled != null && m.sendEnabled.length) { + for (var i = 0; i < m.sendEnabled.length; ++i) + $root.cosmos.bank.v1beta1.SendEnabled.encode(m.sendEnabled[i], w.uint32(10).fork()).ldelim(); + } + if (m.defaultSendEnabled != null && Object.hasOwnProperty.call(m, "defaultSendEnabled")) + w.uint32(16).bool(m.defaultSendEnabled); + return w; + }; + Params.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.cosmos.bank.v1beta1.Params(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + if (!(m.sendEnabled && m.sendEnabled.length)) m.sendEnabled = []; + m.sendEnabled.push($root.cosmos.bank.v1beta1.SendEnabled.decode(r, r.uint32())); + break; + case 2: + m.defaultSendEnabled = r.bool(); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return Params; + })(); + v1beta1.SendEnabled = (function () { + function SendEnabled(p) { + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + SendEnabled.prototype.denom = ""; + SendEnabled.prototype.enabled = false; + SendEnabled.create = function create(properties) { + return new SendEnabled(properties); + }; + SendEnabled.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.denom != null && Object.hasOwnProperty.call(m, "denom")) w.uint32(10).string(m.denom); + if (m.enabled != null && Object.hasOwnProperty.call(m, "enabled")) w.uint32(16).bool(m.enabled); + return w; + }; + SendEnabled.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.cosmos.bank.v1beta1.SendEnabled(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + m.denom = r.string(); + break; + case 2: + m.enabled = r.bool(); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return SendEnabled; + })(); + v1beta1.Input = (function () { + function Input(p) { + this.coins = []; + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + Input.prototype.address = ""; + Input.prototype.coins = $util.emptyArray; + Input.create = function create(properties) { + return new Input(properties); + }; + Input.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.address != null && Object.hasOwnProperty.call(m, "address")) w.uint32(10).string(m.address); + if (m.coins != null && m.coins.length) { + for (var i = 0; i < m.coins.length; ++i) + $root.cosmos.base.v1beta1.Coin.encode(m.coins[i], w.uint32(18).fork()).ldelim(); + } + return w; + }; + Input.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.cosmos.bank.v1beta1.Input(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + m.address = r.string(); + break; + case 2: + if (!(m.coins && m.coins.length)) m.coins = []; + m.coins.push($root.cosmos.base.v1beta1.Coin.decode(r, r.uint32())); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return Input; + })(); + v1beta1.Output = (function () { + function Output(p) { + this.coins = []; + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + Output.prototype.address = ""; + Output.prototype.coins = $util.emptyArray; + Output.create = function create(properties) { + return new Output(properties); + }; + Output.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.address != null && Object.hasOwnProperty.call(m, "address")) w.uint32(10).string(m.address); + if (m.coins != null && m.coins.length) { + for (var i = 0; i < m.coins.length; ++i) + $root.cosmos.base.v1beta1.Coin.encode(m.coins[i], w.uint32(18).fork()).ldelim(); + } + return w; + }; + Output.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.cosmos.bank.v1beta1.Output(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + m.address = r.string(); + break; + case 2: + if (!(m.coins && m.coins.length)) m.coins = []; + m.coins.push($root.cosmos.base.v1beta1.Coin.decode(r, r.uint32())); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return Output; + })(); + v1beta1.Supply = (function () { + function Supply(p) { + this.total = []; + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + Supply.prototype.total = $util.emptyArray; + Supply.create = function create(properties) { + return new Supply(properties); + }; + Supply.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.total != null && m.total.length) { + for (var i = 0; i < m.total.length; ++i) + $root.cosmos.base.v1beta1.Coin.encode(m.total[i], w.uint32(10).fork()).ldelim(); + } + return w; + }; + Supply.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.cosmos.bank.v1beta1.Supply(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + if (!(m.total && m.total.length)) m.total = []; + m.total.push($root.cosmos.base.v1beta1.Coin.decode(r, r.uint32())); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return Supply; + })(); + v1beta1.DenomUnit = (function () { + function DenomUnit(p) { + this.aliases = []; + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + DenomUnit.prototype.denom = ""; + DenomUnit.prototype.exponent = 0; + DenomUnit.prototype.aliases = $util.emptyArray; + DenomUnit.create = function create(properties) { + return new DenomUnit(properties); + }; + DenomUnit.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.denom != null && Object.hasOwnProperty.call(m, "denom")) w.uint32(10).string(m.denom); + if (m.exponent != null && Object.hasOwnProperty.call(m, "exponent")) + w.uint32(16).uint32(m.exponent); + if (m.aliases != null && m.aliases.length) { + for (var i = 0; i < m.aliases.length; ++i) w.uint32(26).string(m.aliases[i]); + } + return w; + }; + DenomUnit.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.cosmos.bank.v1beta1.DenomUnit(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + m.denom = r.string(); + break; + case 2: + m.exponent = r.uint32(); + break; + case 3: + if (!(m.aliases && m.aliases.length)) m.aliases = []; + m.aliases.push(r.string()); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return DenomUnit; + })(); + v1beta1.Metadata = (function () { + function Metadata(p) { + this.denomUnits = []; + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + Metadata.prototype.description = ""; + Metadata.prototype.denomUnits = $util.emptyArray; + Metadata.prototype.base = ""; + Metadata.prototype.display = ""; + Metadata.create = function create(properties) { + return new Metadata(properties); + }; + Metadata.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.description != null && Object.hasOwnProperty.call(m, "description")) + w.uint32(10).string(m.description); + if (m.denomUnits != null && m.denomUnits.length) { + for (var i = 0; i < m.denomUnits.length; ++i) + $root.cosmos.bank.v1beta1.DenomUnit.encode(m.denomUnits[i], w.uint32(18).fork()).ldelim(); + } + if (m.base != null && Object.hasOwnProperty.call(m, "base")) w.uint32(26).string(m.base); + if (m.display != null && Object.hasOwnProperty.call(m, "display")) w.uint32(34).string(m.display); + return w; + }; + Metadata.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.cosmos.bank.v1beta1.Metadata(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + m.description = r.string(); + break; + case 2: + if (!(m.denomUnits && m.denomUnits.length)) m.denomUnits = []; + m.denomUnits.push($root.cosmos.bank.v1beta1.DenomUnit.decode(r, r.uint32())); + break; + case 3: + m.base = r.string(); + break; + case 4: + m.display = r.string(); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return Metadata; + })(); v1beta1.Query = (function () { function Query(rpcImpl, requestDelimited, responseDelimited) { $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); @@ -762,7 +1077,7 @@ exports.cosmos = $root.cosmos = (() => { QueryParamsResponse.encode = function encode(m, w) { if (!w) w = $Writer.create(); if (m.params != null && Object.hasOwnProperty.call(m, "params")) - $root.cosmos.auth.v1beta1.Params.encode(m.params, w.uint32(10).fork()).ldelim(); + $root.cosmos.bank.v1beta1.Params.encode(m.params, w.uint32(10).fork()).ldelim(); return w; }; QueryParamsResponse.decode = function decode(r, l) { @@ -773,7 +1088,7 @@ exports.cosmos = $root.cosmos = (() => { var t = r.uint32(); switch (t >>> 3) { case 1: - m.params = $root.cosmos.auth.v1beta1.Params.decode(r, r.uint32()); + m.params = $root.cosmos.bank.v1beta1.Params.decode(r, r.uint32()); break; default: r.skipType(t & 7); @@ -784,6 +1099,106 @@ exports.cosmos = $root.cosmos = (() => { }; return QueryParamsResponse; })(); + v1beta1.MsgSend = (function () { + function MsgSend(p) { + this.amount = []; + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + MsgSend.prototype.fromAddress = ""; + MsgSend.prototype.toAddress = ""; + MsgSend.prototype.amount = $util.emptyArray; + MsgSend.create = function create(properties) { + return new MsgSend(properties); + }; + MsgSend.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.fromAddress != null && Object.hasOwnProperty.call(m, "fromAddress")) + w.uint32(10).string(m.fromAddress); + if (m.toAddress != null && Object.hasOwnProperty.call(m, "toAddress")) + w.uint32(18).string(m.toAddress); + if (m.amount != null && m.amount.length) { + for (var i = 0; i < m.amount.length; ++i) + $root.cosmos.base.v1beta1.Coin.encode(m.amount[i], w.uint32(26).fork()).ldelim(); + } + return w; + }; + MsgSend.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.cosmos.bank.v1beta1.MsgSend(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + m.fromAddress = r.string(); + break; + case 2: + m.toAddress = r.string(); + break; + case 3: + if (!(m.amount && m.amount.length)) m.amount = []; + m.amount.push($root.cosmos.base.v1beta1.Coin.decode(r, r.uint32())); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return MsgSend; + })(); + v1beta1.MsgMultiSend = (function () { + function MsgMultiSend(p) { + this.inputs = []; + this.outputs = []; + if (p) + for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) + if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; + } + MsgMultiSend.prototype.inputs = $util.emptyArray; + MsgMultiSend.prototype.outputs = $util.emptyArray; + MsgMultiSend.create = function create(properties) { + return new MsgMultiSend(properties); + }; + MsgMultiSend.encode = function encode(m, w) { + if (!w) w = $Writer.create(); + if (m.inputs != null && m.inputs.length) { + for (var i = 0; i < m.inputs.length; ++i) + $root.cosmos.bank.v1beta1.Input.encode(m.inputs[i], w.uint32(10).fork()).ldelim(); + } + if (m.outputs != null && m.outputs.length) { + for (var i = 0; i < m.outputs.length; ++i) + $root.cosmos.bank.v1beta1.Output.encode(m.outputs[i], w.uint32(18).fork()).ldelim(); + } + return w; + }; + MsgMultiSend.decode = function decode(r, l) { + if (!(r instanceof $Reader)) r = $Reader.create(r); + var c = l === undefined ? r.len : r.pos + l, + m = new $root.cosmos.bank.v1beta1.MsgMultiSend(); + while (r.pos < c) { + var t = r.uint32(); + switch (t >>> 3) { + case 1: + if (!(m.inputs && m.inputs.length)) m.inputs = []; + m.inputs.push($root.cosmos.bank.v1beta1.Input.decode(r, r.uint32())); + break; + case 2: + if (!(m.outputs && m.outputs.length)) m.outputs = []; + m.outputs.push($root.cosmos.bank.v1beta1.Output.decode(r, r.uint32())); + break; + default: + r.skipType(t & 7); + break; + } + } + return m; + }; + return MsgMultiSend; + })(); return v1beta1; })(); return bank; diff --git a/packages/stargate/types/codec/generated/codecimpl.d.ts b/packages/stargate/types/codec/generated/codecimpl.d.ts index 346edf38..b72fc457 100644 --- a/packages/stargate/types/codec/generated/codecimpl.d.ts +++ b/packages/stargate/types/codec/generated/codecimpl.d.ts @@ -478,6 +478,361 @@ export namespace cosmos { namespace bank { /** Namespace v1beta1. */ namespace v1beta1 { + /** Properties of a Params. */ + interface IParams { + /** Params sendEnabled */ + sendEnabled?: cosmos.bank.v1beta1.ISendEnabled[] | null; + + /** Params defaultSendEnabled */ + defaultSendEnabled?: boolean | null; + } + + /** Represents a Params. */ + class Params implements IParams { + /** + * Constructs a new Params. + * @param [p] Properties to set + */ + constructor(p?: cosmos.bank.v1beta1.IParams); + + /** Params sendEnabled. */ + public sendEnabled: cosmos.bank.v1beta1.ISendEnabled[]; + + /** Params defaultSendEnabled. */ + public defaultSendEnabled: boolean; + + /** + * Creates a new Params instance using the specified properties. + * @param [properties] Properties to set + * @returns Params instance + */ + public static create(properties?: cosmos.bank.v1beta1.IParams): cosmos.bank.v1beta1.Params; + + /** + * Encodes the specified Params message. Does not implicitly {@link cosmos.bank.v1beta1.Params.verify|verify} messages. + * @param m Params message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: cosmos.bank.v1beta1.IParams, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Params message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns Params + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): cosmos.bank.v1beta1.Params; + } + + /** Properties of a SendEnabled. */ + interface ISendEnabled { + /** SendEnabled denom */ + denom?: string | null; + + /** SendEnabled enabled */ + enabled?: boolean | null; + } + + /** Represents a SendEnabled. */ + class SendEnabled implements ISendEnabled { + /** + * Constructs a new SendEnabled. + * @param [p] Properties to set + */ + constructor(p?: cosmos.bank.v1beta1.ISendEnabled); + + /** SendEnabled denom. */ + public denom: string; + + /** SendEnabled enabled. */ + public enabled: boolean; + + /** + * Creates a new SendEnabled instance using the specified properties. + * @param [properties] Properties to set + * @returns SendEnabled instance + */ + public static create(properties?: cosmos.bank.v1beta1.ISendEnabled): cosmos.bank.v1beta1.SendEnabled; + + /** + * Encodes the specified SendEnabled message. Does not implicitly {@link cosmos.bank.v1beta1.SendEnabled.verify|verify} messages. + * @param m SendEnabled message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: cosmos.bank.v1beta1.ISendEnabled, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SendEnabled message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns SendEnabled + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): cosmos.bank.v1beta1.SendEnabled; + } + + /** Properties of an Input. */ + interface IInput { + /** Input address */ + address?: string | null; + + /** Input coins */ + coins?: cosmos.base.v1beta1.ICoin[] | null; + } + + /** Represents an Input. */ + class Input implements IInput { + /** + * Constructs a new Input. + * @param [p] Properties to set + */ + constructor(p?: cosmos.bank.v1beta1.IInput); + + /** Input address. */ + public address: string; + + /** Input coins. */ + public coins: cosmos.base.v1beta1.ICoin[]; + + /** + * Creates a new Input instance using the specified properties. + * @param [properties] Properties to set + * @returns Input instance + */ + public static create(properties?: cosmos.bank.v1beta1.IInput): cosmos.bank.v1beta1.Input; + + /** + * Encodes the specified Input message. Does not implicitly {@link cosmos.bank.v1beta1.Input.verify|verify} messages. + * @param m Input message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: cosmos.bank.v1beta1.IInput, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Input message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns Input + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): cosmos.bank.v1beta1.Input; + } + + /** Properties of an Output. */ + interface IOutput { + /** Output address */ + address?: string | null; + + /** Output coins */ + coins?: cosmos.base.v1beta1.ICoin[] | null; + } + + /** Represents an Output. */ + class Output implements IOutput { + /** + * Constructs a new Output. + * @param [p] Properties to set + */ + constructor(p?: cosmos.bank.v1beta1.IOutput); + + /** Output address. */ + public address: string; + + /** Output coins. */ + public coins: cosmos.base.v1beta1.ICoin[]; + + /** + * Creates a new Output instance using the specified properties. + * @param [properties] Properties to set + * @returns Output instance + */ + public static create(properties?: cosmos.bank.v1beta1.IOutput): cosmos.bank.v1beta1.Output; + + /** + * Encodes the specified Output message. Does not implicitly {@link cosmos.bank.v1beta1.Output.verify|verify} messages. + * @param m Output message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: cosmos.bank.v1beta1.IOutput, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Output message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns Output + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): cosmos.bank.v1beta1.Output; + } + + /** Properties of a Supply. */ + interface ISupply { + /** Supply total */ + total?: cosmos.base.v1beta1.ICoin[] | null; + } + + /** Represents a Supply. */ + class Supply implements ISupply { + /** + * Constructs a new Supply. + * @param [p] Properties to set + */ + constructor(p?: cosmos.bank.v1beta1.ISupply); + + /** Supply total. */ + public total: cosmos.base.v1beta1.ICoin[]; + + /** + * Creates a new Supply instance using the specified properties. + * @param [properties] Properties to set + * @returns Supply instance + */ + public static create(properties?: cosmos.bank.v1beta1.ISupply): cosmos.bank.v1beta1.Supply; + + /** + * Encodes the specified Supply message. Does not implicitly {@link cosmos.bank.v1beta1.Supply.verify|verify} messages. + * @param m Supply message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: cosmos.bank.v1beta1.ISupply, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Supply message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns Supply + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): cosmos.bank.v1beta1.Supply; + } + + /** Properties of a DenomUnit. */ + interface IDenomUnit { + /** DenomUnit denom */ + denom?: string | null; + + /** DenomUnit exponent */ + exponent?: number | null; + + /** DenomUnit aliases */ + aliases?: string[] | null; + } + + /** Represents a DenomUnit. */ + class DenomUnit implements IDenomUnit { + /** + * Constructs a new DenomUnit. + * @param [p] Properties to set + */ + constructor(p?: cosmos.bank.v1beta1.IDenomUnit); + + /** DenomUnit denom. */ + public denom: string; + + /** DenomUnit exponent. */ + public exponent: number; + + /** DenomUnit aliases. */ + public aliases: string[]; + + /** + * Creates a new DenomUnit instance using the specified properties. + * @param [properties] Properties to set + * @returns DenomUnit instance + */ + public static create(properties?: cosmos.bank.v1beta1.IDenomUnit): cosmos.bank.v1beta1.DenomUnit; + + /** + * Encodes the specified DenomUnit message. Does not implicitly {@link cosmos.bank.v1beta1.DenomUnit.verify|verify} messages. + * @param m DenomUnit message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: cosmos.bank.v1beta1.IDenomUnit, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DenomUnit message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns DenomUnit + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): cosmos.bank.v1beta1.DenomUnit; + } + + /** Properties of a Metadata. */ + interface IMetadata { + /** Metadata description */ + description?: string | null; + + /** Metadata denomUnits */ + denomUnits?: cosmos.bank.v1beta1.IDenomUnit[] | null; + + /** Metadata base */ + base?: string | null; + + /** Metadata display */ + display?: string | null; + } + + /** Represents a Metadata. */ + class Metadata implements IMetadata { + /** + * Constructs a new Metadata. + * @param [p] Properties to set + */ + constructor(p?: cosmos.bank.v1beta1.IMetadata); + + /** Metadata description. */ + public description: string; + + /** Metadata denomUnits. */ + public denomUnits: cosmos.bank.v1beta1.IDenomUnit[]; + + /** Metadata base. */ + public base: string; + + /** Metadata display. */ + public display: string; + + /** + * Creates a new Metadata instance using the specified properties. + * @param [properties] Properties to set + * @returns Metadata instance + */ + public static create(properties?: cosmos.bank.v1beta1.IMetadata): cosmos.bank.v1beta1.Metadata; + + /** + * Encodes the specified Metadata message. Does not implicitly {@link cosmos.bank.v1beta1.Metadata.verify|verify} messages. + * @param m Metadata message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: cosmos.bank.v1beta1.IMetadata, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Metadata message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns Metadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): cosmos.bank.v1beta1.Metadata; + } + /** Represents a Query */ class Query extends $protobuf.rpc.Service { /** @@ -1117,7 +1472,7 @@ export namespace cosmos { /** Properties of a QueryParamsResponse. */ interface IQueryParamsResponse { /** QueryParamsResponse params */ - params?: cosmos.auth.v1beta1.IParams | null; + params?: cosmos.bank.v1beta1.IParams | null; } /** Represents a QueryParamsResponse. */ @@ -1129,7 +1484,7 @@ export namespace cosmos { constructor(p?: cosmos.bank.v1beta1.IQueryParamsResponse); /** QueryParamsResponse params. */ - public params?: cosmos.auth.v1beta1.IParams | null; + public params?: cosmos.bank.v1beta1.IParams | null; /** * Creates a new QueryParamsResponse instance using the specified properties. @@ -1164,6 +1519,112 @@ export namespace cosmos { l?: number, ): cosmos.bank.v1beta1.QueryParamsResponse; } + + /** Properties of a MsgSend. */ + interface IMsgSend { + /** MsgSend fromAddress */ + fromAddress?: string | null; + + /** MsgSend toAddress */ + toAddress?: string | null; + + /** MsgSend amount */ + amount?: cosmos.base.v1beta1.ICoin[] | null; + } + + /** Represents a MsgSend. */ + class MsgSend implements IMsgSend { + /** + * Constructs a new MsgSend. + * @param [p] Properties to set + */ + constructor(p?: cosmos.bank.v1beta1.IMsgSend); + + /** MsgSend fromAddress. */ + public fromAddress: string; + + /** MsgSend toAddress. */ + public toAddress: string; + + /** MsgSend amount. */ + public amount: cosmos.base.v1beta1.ICoin[]; + + /** + * Creates a new MsgSend instance using the specified properties. + * @param [properties] Properties to set + * @returns MsgSend instance + */ + public static create(properties?: cosmos.bank.v1beta1.IMsgSend): cosmos.bank.v1beta1.MsgSend; + + /** + * Encodes the specified MsgSend message. Does not implicitly {@link cosmos.bank.v1beta1.MsgSend.verify|verify} messages. + * @param m MsgSend message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: cosmos.bank.v1beta1.IMsgSend, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MsgSend message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns MsgSend + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): cosmos.bank.v1beta1.MsgSend; + } + + /** Properties of a MsgMultiSend. */ + interface IMsgMultiSend { + /** MsgMultiSend inputs */ + inputs?: cosmos.bank.v1beta1.IInput[] | null; + + /** MsgMultiSend outputs */ + outputs?: cosmos.bank.v1beta1.IOutput[] | null; + } + + /** Represents a MsgMultiSend. */ + class MsgMultiSend implements IMsgMultiSend { + /** + * Constructs a new MsgMultiSend. + * @param [p] Properties to set + */ + constructor(p?: cosmos.bank.v1beta1.IMsgMultiSend); + + /** MsgMultiSend inputs. */ + public inputs: cosmos.bank.v1beta1.IInput[]; + + /** MsgMultiSend outputs. */ + public outputs: cosmos.bank.v1beta1.IOutput[]; + + /** + * Creates a new MsgMultiSend instance using the specified properties. + * @param [properties] Properties to set + * @returns MsgMultiSend instance + */ + public static create( + properties?: cosmos.bank.v1beta1.IMsgMultiSend, + ): cosmos.bank.v1beta1.MsgMultiSend; + + /** + * Encodes the specified MsgMultiSend message. Does not implicitly {@link cosmos.bank.v1beta1.MsgMultiSend.verify|verify} messages. + * @param m MsgMultiSend message or plain object to encode + * @param [w] Writer to encode to + * @returns Writer + */ + public static encode(m: cosmos.bank.v1beta1.IMsgMultiSend, w?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MsgMultiSend message from the specified reader or buffer. + * @param r Reader or buffer to decode from + * @param [l] Message length if known beforehand + * @returns MsgMultiSend + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(r: $protobuf.Reader | Uint8Array, l?: number): cosmos.bank.v1beta1.MsgMultiSend; + } } } From c61711481181ee766d32aceec652542a3a76733e Mon Sep 17 00:00:00 2001 From: willclarktech Date: Tue, 20 Oct 2020 16:32:29 +0200 Subject: [PATCH 12/28] stargate: Update validator in testutils --- packages/stargate/src/queries/auth.spec.ts | 8 ++++---- packages/stargate/src/stargateclient.spec.ts | 4 ++-- packages/stargate/src/testutils.spec.ts | 3 ++- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/stargate/src/queries/auth.spec.ts b/packages/stargate/src/queries/auth.spec.ts index 046c723b..774dfa63 100644 --- a/packages/stargate/src/queries/auth.spec.ts +++ b/packages/stargate/src/queries/auth.spec.ts @@ -37,12 +37,12 @@ describe("AuthExtension", () => { it("works for account with pubkey and non-zero sequence", async () => { pendingWithoutSimapp(); const [client, tmClient] = await makeClientWithAuth(simapp.tendermintUrl); - const account = await client.auth.account(validator.address); + const account = await client.auth.account(validator.delegatorAddress); assert(account); const pubkey = encodePubkey(validator.pubkey); expect(account).toEqual({ - address: validator.address, + address: validator.delegatorAddress, pubKey: Any.create(pubkey), // accountNumber not set sequence: Long.fromNumber(validator.sequence, true), @@ -83,12 +83,12 @@ describe("AuthExtension", () => { it("works for account with pubkey and non-zero sequence", async () => { pendingWithoutSimapp(); const [client, tmClient] = await makeClientWithAuth(simapp.tendermintUrl); - const account = await client.auth.unverified.account(validator.address); + const account = await client.auth.unverified.account(validator.delegatorAddress); assert(account); const pubkey = encodePubkey(validator.pubkey); expect(account).toEqual({ - address: validator.address, + address: validator.delegatorAddress, pubKey: Any.create(pubkey), // accountNumber not set sequence: Long.fromNumber(validator.sequence, true), diff --git a/packages/stargate/src/stargateclient.spec.ts b/packages/stargate/src/stargateclient.spec.ts index c09d95d1..10d906d4 100644 --- a/packages/stargate/src/stargateclient.spec.ts +++ b/packages/stargate/src/stargateclient.spec.ts @@ -91,10 +91,10 @@ describe("StargateClient", () => { pendingWithoutSimapp(); const client = await StargateClient.connect(simapp.tendermintUrl); - const account = await client.getAccount(validator.address); + const account = await client.getAccount(validator.delegatorAddress); assert(account); expect(account).toEqual({ - address: validator.address, + address: validator.delegatorAddress, pubkey: validator.pubkey, accountNumber: validator.accountNumber, sequence: validator.sequence, diff --git a/packages/stargate/src/testutils.spec.ts b/packages/stargate/src/testutils.spec.ts index 1d1dfac5..1e7bb21e 100644 --- a/packages/stargate/src/testutils.spec.ts +++ b/packages/stargate/src/testutils.spec.ts @@ -59,7 +59,8 @@ export const validator = { value: "A/Ltk7FONB0PJOKrLECIxJe5LcJMy9DcWG6X2WVA2xAi", }, /** delegator_address from /cosmos.staking.v1beta1.MsgCreateValidator in scripts/simapp/template/.simapp/config/genesis.json */ - address: "cosmos1gyavpqh80z2v7tcgeycfvf0st2nvjrfcp05dad", + delegatorAddress: "cosmos1gyavpqh80z2v7tcgeycfvf0st2nvjrfcp05dad", + validatorAddress: "cosmosvaloper1gyavpqh80z2v7tcgeycfvf0st2nvjrfcymqc37", accountNumber: 0, sequence: 1, }; From 7d3aa4c9ea576c3522c5304c40114e4007d3437d Mon Sep 17 00:00:00 2001 From: willclarktech Date: Tue, 20 Oct 2020 14:38:47 +0200 Subject: [PATCH 13/28] proto-signing: Export registered decorator and EncodeObject type --- packages/proto-signing/src/index.ts | 4 ++-- packages/proto-signing/types/index.d.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/proto-signing/src/index.ts b/packages/proto-signing/src/index.ts index 2585de8f..00597feb 100644 --- a/packages/proto-signing/src/index.ts +++ b/packages/proto-signing/src/index.ts @@ -1,6 +1,6 @@ export { Coin } from "./msgs"; -export { cosmosField } from "./decorator"; -export { Registry } from "./registry"; +export { cosmosField, registered } from "./decorator"; +export { EncodeObject, Registry } from "./registry"; export { DirectSecp256k1Wallet } from "./directsecp256k1wallet"; export { decodePubkey, encodePubkey } from "./pubkey"; export { isOfflineDirectSigner, OfflineDirectSigner, OfflineSigner } from "./signer"; diff --git a/packages/proto-signing/types/index.d.ts b/packages/proto-signing/types/index.d.ts index 2585de8f..00597feb 100644 --- a/packages/proto-signing/types/index.d.ts +++ b/packages/proto-signing/types/index.d.ts @@ -1,6 +1,6 @@ export { Coin } from "./msgs"; -export { cosmosField } from "./decorator"; -export { Registry } from "./registry"; +export { cosmosField, registered } from "./decorator"; +export { EncodeObject, Registry } from "./registry"; export { DirectSecp256k1Wallet } from "./directsecp256k1wallet"; export { decodePubkey, encodePubkey } from "./pubkey"; export { isOfflineDirectSigner, OfflineDirectSigner, OfflineSigner } from "./signer"; From 1f4f44237585912116bc956022f7283c1dfb2867 Mon Sep 17 00:00:00 2001 From: willclarktech Date: Wed, 21 Oct 2020 17:18:29 +0200 Subject: [PATCH 14/28] stargate: Add SigningCosmosClient --- .../stargate/src/signingstargateclient.ts | 135 ++++++++++++++++++ packages/stargate/src/stargateclient.ts | 2 +- .../stargate/types/signingstargateclient.d.ts | 36 +++++ packages/stargate/types/stargateclient.d.ts | 2 +- 4 files changed, 173 insertions(+), 2 deletions(-) create mode 100644 packages/stargate/src/signingstargateclient.ts create mode 100644 packages/stargate/types/signingstargateclient.d.ts diff --git a/packages/stargate/src/signingstargateclient.ts b/packages/stargate/src/signingstargateclient.ts new file mode 100644 index 00000000..11135f6e --- /dev/null +++ b/packages/stargate/src/signingstargateclient.ts @@ -0,0 +1,135 @@ +/* eslint-disable @typescript-eslint/naming-convention */ +import { fromBase64 } from "@cosmjs/encoding"; +import { + buildFeeTable, + Coin, + CosmosFeeTable, + encodeSecp256k1Pubkey, + GasLimits, + GasPrice, + StdFee, +} from "@cosmjs/launchpad"; +import { Int53 } from "@cosmjs/math"; +import { + EncodeObject, + encodePubkey, + isOfflineDirectSigner, + makeAuthInfoBytes, + makeSignDoc, + OfflineSigner, + Registry, +} from "@cosmjs/proto-signing"; +import { Client as TendermintClient } from "@cosmjs/tendermint-rpc"; + +import { cosmos } from "./codec"; +import { BroadcastTxResponse, StargateClient } from "./stargateclient"; + +const { TxRaw } = cosmos.tx.v1beta1; + +const defaultGasPrice = GasPrice.fromString("0.025ucosm"); +const defaultGasLimits: GasLimits = { send: 80000 }; + +/** Use for testing only */ +export interface PrivateSigningStargateClient { + readonly fees: CosmosFeeTable; + readonly registry: Registry; +} + +export interface SigningStargateClientOptions { + readonly registry?: Registry; + readonly gasPrice?: GasPrice; + readonly gasLimits?: GasLimits; +} + +export class SigningStargateClient extends StargateClient { + private readonly fees: CosmosFeeTable; + private readonly registry: Registry; + private readonly signer: OfflineSigner; + + public static async connectWithWallet( + endpoint: string, + signer: OfflineSigner, + options: SigningStargateClientOptions = {}, + ): Promise { + const tmClient = await TendermintClient.connect(endpoint); + return new SigningStargateClient(tmClient, signer, options); + } + + private constructor( + tmClient: TendermintClient, + signer: OfflineSigner, + options: SigningStargateClientOptions, + ) { + super(tmClient); + const { registry = new Registry(), gasPrice = defaultGasPrice, gasLimits = defaultGasLimits } = options; + this.fees = buildFeeTable(gasPrice, defaultGasLimits, gasLimits); + this.registry = registry; + this.signer = signer; + } + + public async sendTokens( + senderAddress: string, + recipientAddress: string, + transferAmount: readonly Coin[], + memo = "", + ): Promise { + const sendMsg = { + typeUrl: "/cosmos.bank.v1beta1.MsgSend", + value: { + fromAddress: senderAddress, + toAddress: recipientAddress, + amount: transferAmount, + }, + }; + return this.signAndBroadcast(senderAddress, [sendMsg], this.fees.send, memo); + } + + public async signAndBroadcast( + address: string, + messages: readonly EncodeObject[], + fee: StdFee, + memo = "", + ): Promise { + if (!isOfflineDirectSigner(this.signer)) { + throw new Error("Amino signer not yet supported"); + } + + const accountFromSigner = (await this.signer.getAccounts()).find( + (account) => account.address === address, + ); + if (!accountFromSigner) { + throw new Error("Failed to retrieve account from signer"); + } + const pubkey = encodeSecp256k1Pubkey(accountFromSigner.pubkey); + const accountFromChain = await this.getAccount(address); + if (!accountFromChain) { + throw new Error("Account not found"); + } + const { accountNumber, sequence } = accountFromChain; + if (!pubkey) { + throw new Error("Pubkey not known"); + } + const chainId = await this.getChainId(); + const pubkeyAny = encodePubkey(pubkey); + const txBody = { + messages: messages, + memo: memo, + }; + const txBodyBytes = this.registry.encode({ + typeUrl: "/cosmos.tx.v1beta1.TxBody", + value: txBody, + }); + const gasLimit = Int53.fromString(fee.gas).toNumber(); + const authInfoBytes = makeAuthInfoBytes([pubkeyAny], fee.amount, gasLimit, sequence); + + const signDoc = makeSignDoc(txBodyBytes, authInfoBytes, chainId, accountNumber); + const signResponse = await this.signer.signDirect(address, signDoc); + const txRaw = TxRaw.create({ + bodyBytes: txBodyBytes, + authInfoBytes: authInfoBytes, + signatures: [fromBase64(signResponse.signature.signature)], + }); + const signedTx = Uint8Array.from(TxRaw.encode(txRaw).finish()); + return this.broadcastTx(signedTx); + } +} diff --git a/packages/stargate/src/stargateclient.ts b/packages/stargate/src/stargateclient.ts index 2defde96..e8a9da2e 100644 --- a/packages/stargate/src/stargateclient.ts +++ b/packages/stargate/src/stargateclient.ts @@ -123,7 +123,7 @@ export class StargateClient { return new StargateClient(tmClient); } - private constructor(tmClient: TendermintClient) { + protected constructor(tmClient: TendermintClient) { this.tmClient = tmClient; this.queryClient = QueryClient.withExtensions(tmClient, setupAuthExtension, setupBankExtension); } diff --git a/packages/stargate/types/signingstargateclient.d.ts b/packages/stargate/types/signingstargateclient.d.ts new file mode 100644 index 00000000..e782543b --- /dev/null +++ b/packages/stargate/types/signingstargateclient.d.ts @@ -0,0 +1,36 @@ +import { Coin, CosmosFeeTable, GasLimits, GasPrice, StdFee } from "@cosmjs/launchpad"; +import { EncodeObject, OfflineSigner, Registry } from "@cosmjs/proto-signing"; +import { BroadcastTxResponse, StargateClient } from "./stargateclient"; +/** Use for testing only */ +export interface PrivateSigningStargateClient { + readonly fees: CosmosFeeTable; + readonly registry: Registry; +} +export interface SigningStargateClientOptions { + readonly registry?: Registry; + readonly gasPrice?: GasPrice; + readonly gasLimits?: GasLimits; +} +export declare class SigningStargateClient extends StargateClient { + private readonly fees; + private readonly registry; + private readonly signer; + static connectWithWallet( + endpoint: string, + signer: OfflineSigner, + options?: SigningStargateClientOptions, + ): Promise; + private constructor(); + sendTokens( + senderAddress: string, + recipientAddress: string, + transferAmount: readonly Coin[], + memo?: string, + ): Promise; + signAndBroadcast( + address: string, + messages: readonly EncodeObject[], + fee: StdFee, + memo?: string, + ): Promise; +} diff --git a/packages/stargate/types/stargateclient.d.ts b/packages/stargate/types/stargateclient.d.ts index b8c8e460..c2408b1d 100644 --- a/packages/stargate/types/stargateclient.d.ts +++ b/packages/stargate/types/stargateclient.d.ts @@ -52,7 +52,7 @@ export declare class StargateClient { private readonly queryClient; private chainId; static connect(endpoint: string): Promise; - private constructor(); + protected constructor(tmClient: TendermintClient); getChainId(): Promise; getHeight(): Promise; getAccount(searchAddress: string): Promise; From c677990550cf13624bf622ba59581746fa8b992b Mon Sep 17 00:00:00 2001 From: willclarktech Date: Wed, 21 Oct 2020 17:22:28 +0200 Subject: [PATCH 15/28] stargate: Add test for SigningCosmosClient --- .../src/signingstargateclient.spec.ts | 156 ++++++++++++++++++ 1 file changed, 156 insertions(+) create mode 100644 packages/stargate/src/signingstargateclient.spec.ts diff --git a/packages/stargate/src/signingstargateclient.spec.ts b/packages/stargate/src/signingstargateclient.spec.ts new file mode 100644 index 00000000..c99be923 --- /dev/null +++ b/packages/stargate/src/signingstargateclient.spec.ts @@ -0,0 +1,156 @@ +import { coin, coins, GasPrice } from "@cosmjs/launchpad"; +import { DirectSecp256k1Wallet, Registry } from "@cosmjs/proto-signing"; +import { assert } from "@cosmjs/utils"; + +import { cosmos } from "./codec"; +import { PrivateSigningStargateClient, SigningStargateClient } from "./signingstargateclient"; +import { assertIsBroadcastTxSuccess } from "./stargateclient"; +import { faucet, makeRandomAddress, pendingWithoutSimapp, simapp, validator } from "./testutils.spec"; + +describe("SigningStargateClient", () => { + describe("constructor", () => { + it("can be constructed with default fees", async () => { + const wallet = await DirectSecp256k1Wallet.fromMnemonic(faucet.mnemonic); + const client = await SigningStargateClient.connectWithWallet(simapp.tendermintUrl, wallet); + const openedClient = (client as unknown) as PrivateSigningStargateClient; + expect(openedClient.fees).toEqual({ + send: { + amount: [ + { + amount: "2000", + denom: "ucosm", + }, + ], + gas: "80000", + }, + }); + }); + + it("can be constructed with custom registry", async () => { + const wallet = await DirectSecp256k1Wallet.fromMnemonic(faucet.mnemonic); + const registry = new Registry(); + registry.register("/custom.MsgCustom", cosmos.bank.v1beta1.MsgSend); + const options = { registry: registry }; + const client = await SigningStargateClient.connectWithWallet(simapp.tendermintUrl, wallet, options); + const openedClient = (client as unknown) as PrivateSigningStargateClient; + expect(openedClient.registry.lookupType("/custom.MsgCustom")).toEqual(cosmos.bank.v1beta1.MsgSend); + }); + + it("can be constructed with custom gas price", async () => { + const wallet = await DirectSecp256k1Wallet.fromMnemonic(faucet.mnemonic); + const gasPrice = GasPrice.fromString("3.14utest"); + const options = { gasPrice: gasPrice }; + const client = await SigningStargateClient.connectWithWallet(simapp.tendermintUrl, wallet, options); + const openedClient = (client as unknown) as PrivateSigningStargateClient; + expect(openedClient.fees).toEqual({ + send: { + amount: [ + { + amount: "251200", // 3.14 * 80_000 + denom: "utest", + }, + ], + gas: "80000", + }, + }); + }); + + it("can be constructed with custom gas limits", async () => { + const wallet = await DirectSecp256k1Wallet.fromMnemonic(faucet.mnemonic); + const gasLimits = { + send: 160000, + }; + const options = { gasLimits: gasLimits }; + const client = await SigningStargateClient.connectWithWallet(simapp.tendermintUrl, wallet, options); + const openedClient = (client as unknown) as PrivateSigningStargateClient; + expect(openedClient.fees).toEqual({ + send: { + amount: [ + { + amount: "4000", // 0.025 * 160_000 + denom: "ucosm", + }, + ], + gas: "160000", + }, + }); + }); + + it("can be constructed with custom gas price and gas limits", async () => { + const wallet = await DirectSecp256k1Wallet.fromMnemonic(faucet.mnemonic); + const gasPrice = GasPrice.fromString("3.14utest"); + const gasLimits = { + send: 160000, + }; + const options = { gasPrice: gasPrice, gasLimits: gasLimits }; + const client = await SigningStargateClient.connectWithWallet(simapp.tendermintUrl, wallet, options); + const openedClient = (client as unknown) as PrivateSigningStargateClient; + expect(openedClient.fees).toEqual({ + send: { + amount: [ + { + amount: "502400", // 3.14 * 160_000 + denom: "utest", + }, + ], + gas: "160000", + }, + }); + }); + }); + + describe("sendTokens", () => { + it("works", async () => { + pendingWithoutSimapp(); + const wallet = await DirectSecp256k1Wallet.fromMnemonic(faucet.mnemonic); + const client = await SigningStargateClient.connectWithWallet(simapp.tendermintUrl, wallet); + + const transferAmount = coins(7890, "ucosm"); + const beneficiaryAddress = makeRandomAddress(); + const memo = "for dinner"; + + // no tokens here + const before = await client.getBalance(beneficiaryAddress, "ucosm"); + expect(before).toBeNull(); + + // send + const result = await client.sendTokens(faucet.address0, beneficiaryAddress, transferAmount, memo); + assertIsBroadcastTxSuccess(result); + expect(result.rawLog).toBeTruthy(); + + // got tokens + const after = await client.getBalance(beneficiaryAddress, "ucosm"); + assert(after); + expect(after).toEqual(transferAmount[0]); + }); + }); + + describe("signAndBroadcast", () => { + it("works", async () => { + pendingWithoutSimapp(); + const wallet = await DirectSecp256k1Wallet.fromMnemonic(faucet.mnemonic); + const msgDelegateTypeUrl = "/cosmos.staking.v1beta1.MsgDelegate"; + const registry = new Registry(); + registry.register(msgDelegateTypeUrl, cosmos.staking.v1beta1.MsgDelegate); + const options = { registry: registry }; + const client = await SigningStargateClient.connectWithWallet(simapp.tendermintUrl, wallet, options); + + const msg = cosmos.staking.v1beta1.MsgDelegate.create({ + delegatorAddress: faucet.address0, + validatorAddress: validator.validatorAddress, + amount: coin(1234, "ustake"), + }); + const msgAny = { + typeUrl: msgDelegateTypeUrl, + value: msg, + }; + const fee = { + amount: coins(2000, "ucosm"), + gas: "180000", // 180k + }; + const memo = "Use your power wisely"; + const result = await client.signAndBroadcast(faucet.address0, [msgAny], fee, memo); + assertIsBroadcastTxSuccess(result); + }); + }); +}); From c1cf37380e05c1fa6ffd4c8db6a07f28b7db80b6 Mon Sep 17 00:00:00 2001 From: willclarktech Date: Wed, 21 Oct 2020 18:02:52 +0200 Subject: [PATCH 16/28] proto-signing: Allow customizable sign mode in makeAuthBytes --- packages/proto-signing/src/signing.ts | 3 ++- packages/proto-signing/types/signing.d.ts | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/proto-signing/src/signing.ts b/packages/proto-signing/src/signing.ts index ae152779..9f0c23b7 100644 --- a/packages/proto-signing/src/signing.ts +++ b/packages/proto-signing/src/signing.ts @@ -14,13 +14,14 @@ export function makeAuthInfoBytes( feeAmount: readonly cosmos.base.v1beta1.Coin[], gasLimit: number, sequence: number, + signMode = cosmos.tx.signing.v1beta1.SignMode.SIGN_MODE_DIRECT, ): Uint8Array { const authInfo = { signerInfos: pubkeys.map( (pubkey): cosmos.tx.v1beta1.ISignerInfo => ({ publicKey: pubkey, modeInfo: { - single: { mode: cosmos.tx.signing.v1beta1.SignMode.SIGN_MODE_DIRECT }, + single: { mode: signMode }, }, sequence: sequence ? Long.fromNumber(sequence) : undefined, }), diff --git a/packages/proto-signing/types/signing.d.ts b/packages/proto-signing/types/signing.d.ts index e3cc389d..9520bdef 100644 --- a/packages/proto-signing/types/signing.d.ts +++ b/packages/proto-signing/types/signing.d.ts @@ -7,6 +7,7 @@ export declare function makeAuthInfoBytes( feeAmount: readonly cosmos.base.v1beta1.Coin[], gasLimit: number, sequence: number, + signMode?: cosmos.tx.signing.v1beta1.SignMode, ): Uint8Array; export declare function makeSignDoc( bodyBytes: Uint8Array, From 798d79b00eb9b6a54c5bc34d0f529295ab6d1ede Mon Sep 17 00:00:00 2001 From: willclarktech Date: Thu, 22 Oct 2020 13:45:32 +0200 Subject: [PATCH 17/28] cosmwasm: Update for new OfflineSigner --- packages/cosmwasm/src/cosmwasmclient.searchtx.spec.ts | 2 +- packages/cosmwasm/src/cosmwasmclient.spec.ts | 2 +- packages/cosmwasm/src/lcdapi/wasm.spec.ts | 2 +- packages/cosmwasm/src/signingcosmwasmclient.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/cosmwasm/src/cosmwasmclient.searchtx.spec.ts b/packages/cosmwasm/src/cosmwasmclient.searchtx.spec.ts index 987993a4..8dcc6a85 100644 --- a/packages/cosmwasm/src/cosmwasmclient.searchtx.spec.ts +++ b/packages/cosmwasm/src/cosmwasmclient.searchtx.spec.ts @@ -107,7 +107,7 @@ describe("CosmWasmClient.searchTx", () => { const { accountNumber, sequence } = await client.getSequence(); const chainId = await client.getChainId(); const signDoc = makeSignDoc([sendMsg], fee, chainId, memo, accountNumber, sequence); - const { signed, signature } = await wallet.sign(alice.address0, signDoc); + const { signed, signature } = await wallet.signAmino(alice.address0, signDoc); const tx: WrappedStdTx = { type: "cosmos-sdk/StdTx", value: makeStdTx(signed, signature), diff --git a/packages/cosmwasm/src/cosmwasmclient.spec.ts b/packages/cosmwasm/src/cosmwasmclient.spec.ts index 66b5b8be..22863012 100644 --- a/packages/cosmwasm/src/cosmwasmclient.spec.ts +++ b/packages/cosmwasm/src/cosmwasmclient.spec.ts @@ -240,7 +240,7 @@ describe("CosmWasmClient", () => { const chainId = await client.getChainId(); const { accountNumber, sequence } = await client.getSequence(alice.address0); const signDoc = makeSignDoc([sendMsg], fee, chainId, memo, accountNumber, sequence); - const { signed, signature } = await wallet.sign(alice.address0, signDoc); + const { signed, signature } = await wallet.signAmino(alice.address0, signDoc); const signedTx = makeStdTx(signed, signature); const result = await client.broadcastTx(signedTx); assertIsBroadcastTxSuccess(result); diff --git a/packages/cosmwasm/src/lcdapi/wasm.spec.ts b/packages/cosmwasm/src/lcdapi/wasm.spec.ts index c95fa988..0b009e81 100644 --- a/packages/cosmwasm/src/lcdapi/wasm.spec.ts +++ b/packages/cosmwasm/src/lcdapi/wasm.spec.ts @@ -126,7 +126,7 @@ async function executeContract( const { account_number, sequence } = (await client.auth.account(alice.address0)).result.value; const signDoc = makeSignDoc([theMsg], fee, wasmd.chainId, memo, account_number, sequence); - const { signed, signature } = await signer.sign(alice.address0, signDoc); + const { signed, signature } = await signer.signAmino(alice.address0, signDoc); const signedTx = makeStdTx(signed, signature); return client.broadcastTx(signedTx); } diff --git a/packages/cosmwasm/src/signingcosmwasmclient.ts b/packages/cosmwasm/src/signingcosmwasmclient.ts index 31a6dd91..caae01df 100644 --- a/packages/cosmwasm/src/signingcosmwasmclient.ts +++ b/packages/cosmwasm/src/signingcosmwasmclient.ts @@ -361,7 +361,7 @@ export class SigningCosmWasmClient extends CosmWasmClient { const { accountNumber, sequence } = await this.getSequence(); const chainId = await this.getChainId(); const signDoc = makeSignDoc(msgs, fee, chainId, memo, accountNumber, sequence); - const { signed, signature } = await this.signer.sign(this.senderAddress, signDoc); + const { signed, signature } = await this.signer.signAmino(this.senderAddress, signDoc); const signedTx = makeStdTx(signed, signature); return this.broadcastTx(signedTx); } From 8bf0c97c0831545a8d10f0d1adf3354f3d669f02 Mon Sep 17 00:00:00 2001 From: willclarktech Date: Thu, 22 Oct 2020 14:07:55 +0200 Subject: [PATCH 18/28] launchpad-ledger: Update for new OfflineSigner --- packages/launchpad-ledger/src/demo/node.ts | 2 +- packages/launchpad-ledger/src/demo/web.ts | 2 +- packages/launchpad-ledger/src/ledgersigner.spec.ts | 2 +- packages/launchpad-ledger/src/ledgersigner.ts | 4 ++-- packages/launchpad-ledger/types/ledgersigner.d.ts | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/launchpad-ledger/src/demo/node.ts b/packages/launchpad-ledger/src/demo/node.ts index 015a2bde..396a0814 100644 --- a/packages/launchpad-ledger/src/demo/node.ts +++ b/packages/launchpad-ledger/src/demo/node.ts @@ -57,6 +57,6 @@ export async function sign( }, ]; const signDoc = makeSignDoc(msgs, defaultFee, defaultChainId, defaultMemo, accountNumber, defaultSequence); - const { signature } = await signer.sign(fromAddress, signDoc); + const { signature } = await signer.signAmino(fromAddress, signDoc); return signature; } diff --git a/packages/launchpad-ledger/src/demo/web.ts b/packages/launchpad-ledger/src/demo/web.ts index cc217945..cc8fa459 100644 --- a/packages/launchpad-ledger/src/demo/web.ts +++ b/packages/launchpad-ledger/src/demo/web.ts @@ -109,7 +109,7 @@ window.sign = async function sign(signer: LedgerSigner | undefined): Promise { defaultAccountNumber, defaultSequence, ); - const { signed, signature } = await signer.sign(fistAccount.address, signDoc); + const { signed, signature } = await signer.signAmino(fistAccount.address, signDoc); expect(signed).toEqual(signDoc); const valid = await Secp256k1.verifySignature( Secp256k1Signature.fromFixedLength(fromBase64(signature.signature)), diff --git a/packages/launchpad-ledger/src/ledgersigner.ts b/packages/launchpad-ledger/src/ledgersigner.ts index f8ba9f32..464842b7 100644 --- a/packages/launchpad-ledger/src/ledgersigner.ts +++ b/packages/launchpad-ledger/src/ledgersigner.ts @@ -6,7 +6,7 @@ import { OfflineSigner, StdSignDoc, } from "@cosmjs/launchpad"; -import { serializeSignDoc, SignResponse } from "@cosmjs/launchpad"; +import { AminoSignResponse, serializeSignDoc } from "@cosmjs/launchpad"; import Transport from "@ledgerhq/hw-transport"; import { LaunchpadLedger, LaunchpadLedgerOptions } from "./launchpadledger"; @@ -36,7 +36,7 @@ export class LedgerSigner implements OfflineSigner { return this.accounts; } - public async sign(signerAddress: string, signDoc: StdSignDoc): Promise { + public async signAmino(signerAddress: string, signDoc: StdSignDoc): Promise { const accounts = this.accounts || (await this.getAccounts()); const accountIndex = accounts.findIndex((account) => account.address === signerAddress); diff --git a/packages/launchpad-ledger/types/ledgersigner.d.ts b/packages/launchpad-ledger/types/ledgersigner.d.ts index 9c2c6c5d..80505ec0 100644 --- a/packages/launchpad-ledger/types/ledgersigner.d.ts +++ b/packages/launchpad-ledger/types/ledgersigner.d.ts @@ -1,6 +1,6 @@ /// import { AccountData, OfflineSigner, StdSignDoc } from "@cosmjs/launchpad"; -import { SignResponse } from "@cosmjs/launchpad"; +import { AminoSignResponse } from "@cosmjs/launchpad"; import Transport from "@ledgerhq/hw-transport"; import { LaunchpadLedgerOptions } from "./launchpadledger"; export declare class LedgerSigner implements OfflineSigner { @@ -9,5 +9,5 @@ export declare class LedgerSigner implements OfflineSigner { private accounts?; constructor(transport: Transport, options?: LaunchpadLedgerOptions); getAccounts(): Promise; - sign(signerAddress: string, signDoc: StdSignDoc): Promise; + signAmino(signerAddress: string, signDoc: StdSignDoc): Promise; } From 3d57bf9e29d043b5314fe0432c13c036cb5432e6 Mon Sep 17 00:00:00 2001 From: willclarktech Date: Tue, 27 Oct 2020 12:37:59 +0100 Subject: [PATCH 19/28] stargate: Support Amino signing in signAndBroadcast --- .../src/signingstargateclient.spec.ts | 31 ++++++++- .../stargate/src/signingstargateclient.ts | 69 ++++++++++++++++--- 2 files changed, 90 insertions(+), 10 deletions(-) diff --git a/packages/stargate/src/signingstargateclient.spec.ts b/packages/stargate/src/signingstargateclient.spec.ts index c99be923..cb6a7fe4 100644 --- a/packages/stargate/src/signingstargateclient.spec.ts +++ b/packages/stargate/src/signingstargateclient.spec.ts @@ -1,4 +1,4 @@ -import { coin, coins, GasPrice } from "@cosmjs/launchpad"; +import { coin, coins, GasPrice, Secp256k1HdWallet } from "@cosmjs/launchpad"; import { DirectSecp256k1Wallet, Registry } from "@cosmjs/proto-signing"; import { assert } from "@cosmjs/utils"; @@ -126,7 +126,7 @@ describe("SigningStargateClient", () => { }); describe("signAndBroadcast", () => { - it("works", async () => { + it("works with direct mode", async () => { pendingWithoutSimapp(); const wallet = await DirectSecp256k1Wallet.fromMnemonic(faucet.mnemonic); const msgDelegateTypeUrl = "/cosmos.staking.v1beta1.MsgDelegate"; @@ -152,5 +152,32 @@ describe("SigningStargateClient", () => { const result = await client.signAndBroadcast(faucet.address0, [msgAny], fee, memo); assertIsBroadcastTxSuccess(result); }); + + it("works with legacy Amino mode", async () => { + pendingWithoutSimapp(); + const wallet = await Secp256k1HdWallet.fromMnemonic(faucet.mnemonic); + const msgDelegateTypeUrl = "/cosmos.staking.v1beta1.MsgDelegate"; + const registry = new Registry(); + registry.register(msgDelegateTypeUrl, cosmos.staking.v1beta1.MsgDelegate); + const options = { registry: registry }; + const client = await SigningStargateClient.connectWithWallet(simapp.tendermintUrl, wallet, options); + + const msg = cosmos.staking.v1beta1.MsgDelegate.create({ + delegatorAddress: faucet.address0, + validatorAddress: validator.validatorAddress, + amount: coin(1234, "ustake"), + }); + const msgAny = { + typeUrl: msgDelegateTypeUrl, + value: msg, + }; + const fee = { + amount: coins(2000, "ucosm"), + gas: "200000", + }; + const memo = "Use your power wisely"; + const result = await client.signAndBroadcast(faucet.address0, [msgAny], fee, memo); + assertIsBroadcastTxSuccess(result); + }); }); }); diff --git a/packages/stargate/src/signingstargateclient.ts b/packages/stargate/src/signingstargateclient.ts index 11135f6e..e7203f49 100644 --- a/packages/stargate/src/signingstargateclient.ts +++ b/packages/stargate/src/signingstargateclient.ts @@ -1,13 +1,17 @@ /* eslint-disable @typescript-eslint/naming-convention */ import { fromBase64 } from "@cosmjs/encoding"; import { + AccountData, buildFeeTable, Coin, CosmosFeeTable, encodeSecp256k1Pubkey, GasLimits, GasPrice, + makeSignDoc as makeSignDocAmino, + Msg, StdFee, + StdSignDoc, } from "@cosmjs/launchpad"; import { Int53 } from "@cosmjs/math"; import { @@ -26,6 +30,40 @@ import { BroadcastTxResponse, StargateClient } from "./stargateclient"; const { TxRaw } = cosmos.tx.v1beta1; +function snakifyMsgValue(obj: Msg): Msg { + return { + ...obj, + value: Object.entries(obj.value).reduce( + (snakified, [key, value]) => ({ + ...snakified, + [key + .split(/(?=[A-Z])/) + .join("_") + .toLowerCase()]: value, + }), + {}, + ), + }; +} + +function snakifyForAmino(signDoc: StdSignDoc): StdSignDoc { + return { + ...signDoc, + msgs: signDoc.msgs.map(snakifyMsgValue), + }; +} + +function getMsgType(typeUrl: string): string { + const typeRegister: Record = { + "/cosmos.staking.v1beta1.MsgDelegate": "cosmos-sdk/MsgDelegate", + }; + const type = typeRegister[typeUrl]; + if (!type) { + throw new Error("Type URL not known"); + } + return type; +} + const defaultGasPrice = GasPrice.fromString("0.025ucosm"); const defaultGasLimits: GasLimits = { send: 80000 }; @@ -90,12 +128,8 @@ export class SigningStargateClient extends StargateClient { fee: StdFee, memo = "", ): Promise { - if (!isOfflineDirectSigner(this.signer)) { - throw new Error("Amino signer not yet supported"); - } - const accountFromSigner = (await this.signer.getAccounts()).find( - (account) => account.address === address, + (account: AccountData) => account.address === address, ); if (!accountFromSigner) { throw new Error("Failed to retrieve account from signer"); @@ -120,10 +154,29 @@ export class SigningStargateClient extends StargateClient { value: txBody, }); const gasLimit = Int53.fromString(fee.gas).toNumber(); - const authInfoBytes = makeAuthInfoBytes([pubkeyAny], fee.amount, gasLimit, sequence); - const signDoc = makeSignDoc(txBodyBytes, authInfoBytes, chainId, accountNumber); - const signResponse = await this.signer.signDirect(address, signDoc); + if (isOfflineDirectSigner(this.signer)) { + const authInfoBytes = makeAuthInfoBytes([pubkeyAny], fee.amount, gasLimit, sequence); + const signDoc = makeSignDoc(txBodyBytes, authInfoBytes, chainId, accountNumber); + const signResponse = await this.signer.signDirect(address, signDoc); + const txRaw = TxRaw.create({ + bodyBytes: txBodyBytes, + authInfoBytes: authInfoBytes, + signatures: [fromBase64(signResponse.signature.signature)], + }); + const signedTx = Uint8Array.from(TxRaw.encode(txRaw).finish()); + return this.broadcastTx(signedTx); + } + + // Amino signer + const signMode = cosmos.tx.signing.v1beta1.SignMode.SIGN_MODE_LEGACY_AMINO_JSON; + const authInfoBytes = makeAuthInfoBytes([pubkeyAny], fee.amount, gasLimit, sequence, signMode); + const msgs = messages.map((msg) => ({ + type: getMsgType(msg.typeUrl), + value: msg.value, + })); + const signDoc = makeSignDocAmino(msgs, fee, chainId, memo, accountNumber, sequence); + const signResponse = await this.signer.signAmino(address, snakifyForAmino(signDoc)); const txRaw = TxRaw.create({ bodyBytes: txBodyBytes, authInfoBytes: authInfoBytes, From 6030487cc964d792a78225da8eeed510cf73baf4 Mon Sep 17 00:00:00 2001 From: willclarktech Date: Tue, 27 Oct 2020 13:39:54 +0100 Subject: [PATCH 20/28] stargate: Fix lint errors --- packages/proto-signing/src/directsecp256k1wallet.spec.ts | 1 - packages/proto-signing/src/signing.spec.ts | 1 - packages/stargate/src/stargateclient.spec.ts | 1 - 3 files changed, 3 deletions(-) diff --git a/packages/proto-signing/src/directsecp256k1wallet.spec.ts b/packages/proto-signing/src/directsecp256k1wallet.spec.ts index cd199b99..1e51c72a 100644 --- a/packages/proto-signing/src/directsecp256k1wallet.spec.ts +++ b/packages/proto-signing/src/directsecp256k1wallet.spec.ts @@ -1,7 +1,6 @@ import { Secp256k1, Secp256k1Signature, sha256 } from "@cosmjs/crypto"; import { fromBase64, fromHex } from "@cosmjs/encoding"; import { coins } from "@cosmjs/launchpad"; -import Long from "long"; import { DirectSecp256k1Wallet } from "./directsecp256k1wallet"; import { makeAuthInfoBytes, makeSignBytes, makeSignDoc } from "./signing"; diff --git a/packages/proto-signing/src/signing.spec.ts b/packages/proto-signing/src/signing.spec.ts index 26e0c284..2a1ad8fd 100644 --- a/packages/proto-signing/src/signing.spec.ts +++ b/packages/proto-signing/src/signing.spec.ts @@ -1,6 +1,5 @@ /* eslint-disable @typescript-eslint/naming-convention */ import { fromBase64, fromHex, toHex } from "@cosmjs/encoding"; -import Long from "long"; import { cosmos, google } from "./codec"; import { DirectSecp256k1Wallet } from "./directsecp256k1wallet"; diff --git a/packages/stargate/src/stargateclient.spec.ts b/packages/stargate/src/stargateclient.spec.ts index 10d906d4..c8d7357d 100644 --- a/packages/stargate/src/stargateclient.spec.ts +++ b/packages/stargate/src/stargateclient.spec.ts @@ -4,7 +4,6 @@ import { DirectSecp256k1Wallet, encodePubkey, makeAuthInfoBytes, - makeSignBytes, makeSignDoc, Registry, } from "@cosmjs/proto-signing"; From bfa2525bfa224d3b09fb261b3c4a27aec32207a8 Mon Sep 17 00:00:00 2001 From: willclarktech Date: Tue, 27 Oct 2020 15:42:50 +0100 Subject: [PATCH 21/28] stargate: Extract encoding helpers and add tests --- packages/stargate/src/encoding.spec.ts | 58 +++++++++++++++++++ packages/stargate/src/encoding.ts | 35 +++++++++++ .../stargate/src/signingstargateclient.ts | 37 +----------- packages/stargate/types/encoding.d.ts | 3 + 4 files changed, 97 insertions(+), 36 deletions(-) create mode 100644 packages/stargate/src/encoding.spec.ts create mode 100644 packages/stargate/src/encoding.ts create mode 100644 packages/stargate/types/encoding.d.ts diff --git a/packages/stargate/src/encoding.spec.ts b/packages/stargate/src/encoding.spec.ts new file mode 100644 index 00000000..e5611827 --- /dev/null +++ b/packages/stargate/src/encoding.spec.ts @@ -0,0 +1,58 @@ +/* eslint-disable @typescript-eslint/naming-convention */ +import { coin, coins, makeSignDoc as makeSignDocAmino } from "@cosmjs/launchpad"; + +import { cosmos } from "./codec"; +import { getMsgType, snakifyForAmino } from "./encoding"; +import { faucet, validator } from "./testutils.spec"; + +describe("encoding", () => { + describe("snakifyForAmino", () => { + it("works", () => { + const msg = cosmos.staking.v1beta1.MsgDelegate.create({ + delegatorAddress: faucet.address0, + validatorAddress: validator.validatorAddress, + amount: coin(1234, "ustake"), + }); + const msgAny = { + type: "cosmos-sdk/MsgDelegate", + value: msg, + }; + const fee = { + amount: coins(2000, "ucosm"), + gas: "200000", + }; + const chainId = "testing"; + const memo = "testing testing"; + const accountNumber = 1; + const sequence = 16; + const signDoc = makeSignDocAmino([msgAny], fee, chainId, memo, accountNumber, sequence); + expect(snakifyForAmino(signDoc)).toEqual({ + ...signDoc, + msgs: [ + { + type: "cosmos-sdk/MsgDelegate", + value: { + delegator_address: faucet.address0, + validator_address: validator.validatorAddress, + amount: { + amount: "1234", + denom: "ustake", + }, + }, + }, + ], + }); + }); + }); + + describe("getMsgType", () => { + it("works for known type url", () => { + const msgType = getMsgType("/cosmos.staking.v1beta1.MsgDelegate"); + expect(msgType).toEqual("cosmos-sdk/MsgDelegate"); + }); + + it("throws for unknown type url", () => { + expect(() => getMsgType("/xxx.Unknown")).toThrowError(/type url not known/i); + }); + }); +}); diff --git a/packages/stargate/src/encoding.ts b/packages/stargate/src/encoding.ts new file mode 100644 index 00000000..b745fc05 --- /dev/null +++ b/packages/stargate/src/encoding.ts @@ -0,0 +1,35 @@ +import { Msg, StdSignDoc } from "@cosmjs/launchpad"; + +function snakifyMsgValue(obj: Msg): Msg { + return { + ...obj, + value: Object.entries(obj.value).reduce( + (snakified, [key, value]) => ({ + ...snakified, + [key + .split(/(?=[A-Z])/) + .join("_") + .toLowerCase()]: value, + }), + {}, + ), + }; +} + +export function snakifyForAmino(signDoc: StdSignDoc): StdSignDoc { + return { + ...signDoc, + msgs: signDoc.msgs.map(snakifyMsgValue), + }; +} + +export function getMsgType(typeUrl: string): string { + const typeRegister: Record = { + "/cosmos.staking.v1beta1.MsgDelegate": "cosmos-sdk/MsgDelegate", + }; + const type = typeRegister[typeUrl]; + if (!type) { + throw new Error("Type URL not known"); + } + return type; +} diff --git a/packages/stargate/src/signingstargateclient.ts b/packages/stargate/src/signingstargateclient.ts index e7203f49..288b8e28 100644 --- a/packages/stargate/src/signingstargateclient.ts +++ b/packages/stargate/src/signingstargateclient.ts @@ -9,9 +9,7 @@ import { GasLimits, GasPrice, makeSignDoc as makeSignDocAmino, - Msg, StdFee, - StdSignDoc, } from "@cosmjs/launchpad"; import { Int53 } from "@cosmjs/math"; import { @@ -26,44 +24,11 @@ import { import { Client as TendermintClient } from "@cosmjs/tendermint-rpc"; import { cosmos } from "./codec"; +import { getMsgType, snakifyForAmino } from "./encoding"; import { BroadcastTxResponse, StargateClient } from "./stargateclient"; const { TxRaw } = cosmos.tx.v1beta1; -function snakifyMsgValue(obj: Msg): Msg { - return { - ...obj, - value: Object.entries(obj.value).reduce( - (snakified, [key, value]) => ({ - ...snakified, - [key - .split(/(?=[A-Z])/) - .join("_") - .toLowerCase()]: value, - }), - {}, - ), - }; -} - -function snakifyForAmino(signDoc: StdSignDoc): StdSignDoc { - return { - ...signDoc, - msgs: signDoc.msgs.map(snakifyMsgValue), - }; -} - -function getMsgType(typeUrl: string): string { - const typeRegister: Record = { - "/cosmos.staking.v1beta1.MsgDelegate": "cosmos-sdk/MsgDelegate", - }; - const type = typeRegister[typeUrl]; - if (!type) { - throw new Error("Type URL not known"); - } - return type; -} - const defaultGasPrice = GasPrice.fromString("0.025ucosm"); const defaultGasLimits: GasLimits = { send: 80000 }; diff --git a/packages/stargate/types/encoding.d.ts b/packages/stargate/types/encoding.d.ts new file mode 100644 index 00000000..605706cb --- /dev/null +++ b/packages/stargate/types/encoding.d.ts @@ -0,0 +1,3 @@ +import { StdSignDoc } from "@cosmjs/launchpad"; +export declare function snakifyForAmino(signDoc: StdSignDoc): StdSignDoc; +export declare function getMsgType(typeUrl: string): string; From 17baf1565c7db4058af3c000a89b9ec9819e453f Mon Sep 17 00:00:00 2001 From: willclarktech Date: Tue, 27 Oct 2020 15:52:09 +0100 Subject: [PATCH 22/28] stargate: Fill out msg types --- packages/stargate/src/encoding.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/packages/stargate/src/encoding.ts b/packages/stargate/src/encoding.ts index b745fc05..f46c9cbf 100644 --- a/packages/stargate/src/encoding.ts +++ b/packages/stargate/src/encoding.ts @@ -25,7 +25,24 @@ export function snakifyForAmino(signDoc: StdSignDoc): StdSignDoc { export function getMsgType(typeUrl: string): string { const typeRegister: Record = { + "/cosmos.bank.v1beta1.MsgSend": "cosmos-sdk/MsgSend", + "/cosmos.bank.v1beta1.MsgMultiSend": "cosmos-sdk/MsgMultiSend", + "/cosmos.crisis.v1beta1.MsgVerifyInvariant": "cosmos-sdk/MsgVerifyInvariant", + "/cosmos.distribution.v1beta1.MsgSetWithdrawAddress": "cosmos-sdk/MsgSetWithdrawAddress", + "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward": "cosmos-sdk/MsgWithdrawDelegatorReward", + "/cosmos.distribution.v1beta1.MsgWithdrawValidatorComission": "cosmos-sdk/MsgWithdrawValidatorComission", + "/cosmos.distribution.v1beta1.MsgFundCommunityPool": "cosmos-sdk/MsgFundCommunityPool", + "/cosmos.evidence.v1beta1.MsgSubmitEvidence": "cosmos-sdk/MsgSubmitEvidence", + "/cosmos.gov.v1beta1.MsgSubmitProposal": "cosmos-sdk/MsgSubmitProposal", + "/cosmos.gov.v1beta1.MsgVote": "cosmos-sdk/MsgVote", + "/cosmos.gov.v1beta1.MsgDeposit": "cosmos-sdk/MsgDeposit", + "/cosmos.slashing.v1beta1.MsgUnjail": "cosmos-sdk/MsgUnjail", + "/cosmos.staking.v1beta1.MsgCreateValidator": "cosmos-sdk/MsgCreateValidator", + "/cosmos.staking.v1beta1.MsgEditValidator": "cosmos-sdk/MsgEditValidator", "/cosmos.staking.v1beta1.MsgDelegate": "cosmos-sdk/MsgDelegate", + "/cosmos.staking.v1beta1.MsgBeginRedelegate": "cosmos-sdk/MsgBeginRedelegate", + "/cosmos.staking.v1beta1.MsgUndelegate": "cosmos-sdk/MsgUndelegate", + "/cosmos.vesting.v1beta1.MsgCreateVestingAccount": "cosmos-sdk/MsgCreateVestingAccount", }; const type = typeRegister[typeUrl]; if (!type) { From 27d518898b2b74683115ab009883c7563a071c38 Mon Sep 17 00:00:00 2001 From: willclarktech Date: Tue, 27 Oct 2020 16:09:34 +0100 Subject: [PATCH 23/28] launchpad: Adjust secp256k1wallet for new OfflineSigner --- packages/launchpad/src/secp256k1wallet.spec.ts | 4 ++-- packages/launchpad/src/secp256k1wallet.ts | 4 ++-- packages/launchpad/types/secp256k1wallet.d.ts | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/launchpad/src/secp256k1wallet.spec.ts b/packages/launchpad/src/secp256k1wallet.spec.ts index 93d63682..c03fd3c6 100644 --- a/packages/launchpad/src/secp256k1wallet.spec.ts +++ b/packages/launchpad/src/secp256k1wallet.spec.ts @@ -30,7 +30,7 @@ describe("Secp256k1Wallet", () => { }); }); - describe("sign", () => { + describe("signAmino", () => { it("resolves to valid signature", async () => { const signer = await Secp256k1Wallet.fromKey(defaultPrivkey); const signDoc: StdSignDoc = { @@ -41,7 +41,7 @@ describe("Secp256k1Wallet", () => { account_number: "7", sequence: "54", }; - const { signed, signature } = await signer.sign(defaultAddress, signDoc); + const { signed, signature } = await signer.signAmino(defaultAddress, signDoc); expect(signed).toEqual(signDoc); const valid = await Secp256k1.verifySignature( Secp256k1Signature.fromFixedLength(fromBase64(signature.signature)), diff --git a/packages/launchpad/src/secp256k1wallet.ts b/packages/launchpad/src/secp256k1wallet.ts index 7580d484..b8e84960 100644 --- a/packages/launchpad/src/secp256k1wallet.ts +++ b/packages/launchpad/src/secp256k1wallet.ts @@ -3,7 +3,7 @@ import { Secp256k1, Sha256 } from "@cosmjs/crypto"; import { rawSecp256k1PubkeyToAddress } from "./address"; import { serializeSignDoc, StdSignDoc } from "./encoding"; import { encodeSecp256k1Signature } from "./signature"; -import { AccountData, OfflineSigner, SignResponse } from "./signer"; +import { AccountData, AminoSignResponse, OfflineSigner } from "./signer"; /** * A wallet that holds a single secp256k1 keypair. @@ -46,7 +46,7 @@ export class Secp256k1Wallet implements OfflineSigner { ]; } - public async sign(signerAddress: string, signDoc: StdSignDoc): Promise { + public async signAmino(signerAddress: string, signDoc: StdSignDoc): Promise { if (signerAddress !== this.address) { throw new Error(`Address ${signerAddress} not found in wallet`); } diff --git a/packages/launchpad/types/secp256k1wallet.d.ts b/packages/launchpad/types/secp256k1wallet.d.ts index ef0f87e7..5e2d89f0 100644 --- a/packages/launchpad/types/secp256k1wallet.d.ts +++ b/packages/launchpad/types/secp256k1wallet.d.ts @@ -1,5 +1,5 @@ import { StdSignDoc } from "./encoding"; -import { AccountData, OfflineSigner, SignResponse } from "./signer"; +import { AccountData, OfflineSigner, AminoSignResponse } from "./signer"; /** * A wallet that holds a single secp256k1 keypair. * @@ -19,5 +19,5 @@ export declare class Secp256k1Wallet implements OfflineSigner { private constructor(); private get address(); getAccounts(): Promise; - sign(signerAddress: string, signDoc: StdSignDoc): Promise; + signAmino(signerAddress: string, signDoc: StdSignDoc): Promise; } From 36d4c9d97b3463eb8362cee1e10c9688611ebcd9 Mon Sep 17 00:00:00 2001 From: willclarktech Date: Tue, 27 Oct 2020 16:43:10 +0100 Subject: [PATCH 24/28] stargate: Update amino signAndBroadcast test --- .../src/signingstargateclient.spec.ts | 27 ++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/packages/stargate/src/signingstargateclient.spec.ts b/packages/stargate/src/signingstargateclient.spec.ts index cb6a7fe4..507d7901 100644 --- a/packages/stargate/src/signingstargateclient.spec.ts +++ b/packages/stargate/src/signingstargateclient.spec.ts @@ -1,6 +1,8 @@ +/* eslint-disable @typescript-eslint/naming-convention */ import { coin, coins, GasPrice, Secp256k1HdWallet } from "@cosmjs/launchpad"; -import { DirectSecp256k1Wallet, Registry } from "@cosmjs/proto-signing"; +import { Coin, cosmosField, DirectSecp256k1Wallet, registered, Registry } from "@cosmjs/proto-signing"; import { assert } from "@cosmjs/utils"; +import { Message } from "protobufjs"; import { cosmos } from "./codec"; import { PrivateSigningStargateClient, SigningStargateClient } from "./signingstargateclient"; @@ -156,17 +158,30 @@ describe("SigningStargateClient", () => { it("works with legacy Amino mode", async () => { pendingWithoutSimapp(); const wallet = await Secp256k1HdWallet.fromMnemonic(faucet.mnemonic); + const coinTypeUrl = "/cosmos.base.v1beta.Coin"; const msgDelegateTypeUrl = "/cosmos.staking.v1beta1.MsgDelegate"; const registry = new Registry(); - registry.register(msgDelegateTypeUrl, cosmos.staking.v1beta1.MsgDelegate); + registry.register(coinTypeUrl, Coin); + + @registered(registry, msgDelegateTypeUrl) + // eslint-disable-next-line @typescript-eslint/no-unused-vars + class MsgDelegate extends Message { + @cosmosField.string(1) + public readonly delegator_address?: string; + @cosmosField.string(2) + public readonly validator_address?: string; + @cosmosField.message(3, Coin) + public readonly amount?: Coin; + } + const options = { registry: registry }; const client = await SigningStargateClient.connectWithWallet(simapp.tendermintUrl, wallet, options); - const msg = cosmos.staking.v1beta1.MsgDelegate.create({ - delegatorAddress: faucet.address0, - validatorAddress: validator.validatorAddress, + const msg = { + delegator_address: faucet.address0, + validator_address: validator.validatorAddress, amount: coin(1234, "ustake"), - }); + }; const msgAny = { typeUrl: msgDelegateTypeUrl, value: msg, From e08ee36297f5a0db683915f47ad4eafd3b4d17d3 Mon Sep 17 00:00:00 2001 From: willclarktech Date: Tue, 27 Oct 2020 16:45:22 +0100 Subject: [PATCH 25/28] stargate: Remove snakifyForAmino encoding helper --- packages/stargate/src/encoding.spec.ts | 45 +------------------ packages/stargate/src/encoding.ts | 25 ----------- .../stargate/src/signingstargateclient.ts | 4 +- packages/stargate/types/encoding.d.ts | 2 - 4 files changed, 3 insertions(+), 73 deletions(-) diff --git a/packages/stargate/src/encoding.spec.ts b/packages/stargate/src/encoding.spec.ts index e5611827..d36b1f18 100644 --- a/packages/stargate/src/encoding.spec.ts +++ b/packages/stargate/src/encoding.spec.ts @@ -1,50 +1,7 @@ /* eslint-disable @typescript-eslint/naming-convention */ -import { coin, coins, makeSignDoc as makeSignDocAmino } from "@cosmjs/launchpad"; - -import { cosmos } from "./codec"; -import { getMsgType, snakifyForAmino } from "./encoding"; -import { faucet, validator } from "./testutils.spec"; +import { getMsgType } from "./encoding"; describe("encoding", () => { - describe("snakifyForAmino", () => { - it("works", () => { - const msg = cosmos.staking.v1beta1.MsgDelegate.create({ - delegatorAddress: faucet.address0, - validatorAddress: validator.validatorAddress, - amount: coin(1234, "ustake"), - }); - const msgAny = { - type: "cosmos-sdk/MsgDelegate", - value: msg, - }; - const fee = { - amount: coins(2000, "ucosm"), - gas: "200000", - }; - const chainId = "testing"; - const memo = "testing testing"; - const accountNumber = 1; - const sequence = 16; - const signDoc = makeSignDocAmino([msgAny], fee, chainId, memo, accountNumber, sequence); - expect(snakifyForAmino(signDoc)).toEqual({ - ...signDoc, - msgs: [ - { - type: "cosmos-sdk/MsgDelegate", - value: { - delegator_address: faucet.address0, - validator_address: validator.validatorAddress, - amount: { - amount: "1234", - denom: "ustake", - }, - }, - }, - ], - }); - }); - }); - describe("getMsgType", () => { it("works for known type url", () => { const msgType = getMsgType("/cosmos.staking.v1beta1.MsgDelegate"); diff --git a/packages/stargate/src/encoding.ts b/packages/stargate/src/encoding.ts index f46c9cbf..8b238a79 100644 --- a/packages/stargate/src/encoding.ts +++ b/packages/stargate/src/encoding.ts @@ -1,28 +1,3 @@ -import { Msg, StdSignDoc } from "@cosmjs/launchpad"; - -function snakifyMsgValue(obj: Msg): Msg { - return { - ...obj, - value: Object.entries(obj.value).reduce( - (snakified, [key, value]) => ({ - ...snakified, - [key - .split(/(?=[A-Z])/) - .join("_") - .toLowerCase()]: value, - }), - {}, - ), - }; -} - -export function snakifyForAmino(signDoc: StdSignDoc): StdSignDoc { - return { - ...signDoc, - msgs: signDoc.msgs.map(snakifyMsgValue), - }; -} - export function getMsgType(typeUrl: string): string { const typeRegister: Record = { "/cosmos.bank.v1beta1.MsgSend": "cosmos-sdk/MsgSend", diff --git a/packages/stargate/src/signingstargateclient.ts b/packages/stargate/src/signingstargateclient.ts index 288b8e28..e2dc7d41 100644 --- a/packages/stargate/src/signingstargateclient.ts +++ b/packages/stargate/src/signingstargateclient.ts @@ -24,7 +24,7 @@ import { import { Client as TendermintClient } from "@cosmjs/tendermint-rpc"; import { cosmos } from "./codec"; -import { getMsgType, snakifyForAmino } from "./encoding"; +import { getMsgType } from "./encoding"; import { BroadcastTxResponse, StargateClient } from "./stargateclient"; const { TxRaw } = cosmos.tx.v1beta1; @@ -141,7 +141,7 @@ export class SigningStargateClient extends StargateClient { value: msg.value, })); const signDoc = makeSignDocAmino(msgs, fee, chainId, memo, accountNumber, sequence); - const signResponse = await this.signer.signAmino(address, snakifyForAmino(signDoc)); + const signResponse = await this.signer.signAmino(address, signDoc); const txRaw = TxRaw.create({ bodyBytes: txBodyBytes, authInfoBytes: authInfoBytes, diff --git a/packages/stargate/types/encoding.d.ts b/packages/stargate/types/encoding.d.ts index 605706cb..6404c1ca 100644 --- a/packages/stargate/types/encoding.d.ts +++ b/packages/stargate/types/encoding.d.ts @@ -1,3 +1 @@ -import { StdSignDoc } from "@cosmjs/launchpad"; -export declare function snakifyForAmino(signDoc: StdSignDoc): StdSignDoc; export declare function getMsgType(typeUrl: string): string; From ff4ef4a084bc83d88e60a89cbbf6be2915953775 Mon Sep 17 00:00:00 2001 From: willclarktech Date: Tue, 27 Oct 2020 16:56:16 +0100 Subject: [PATCH 26/28] cli: Update for new OfflineSigner --- packages/cli/README.md | 2 +- packages/cli/examples/delegate.ts | 2 +- packages/cli/src/cli.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/cli/README.md b/packages/cli/README.md index 47818805..525970d1 100644 --- a/packages/cli/README.md +++ b/packages/cli/README.md @@ -74,7 +74,7 @@ const signDoc = makeSignDoc( account_number, sequence, ); -const { signed, signature } = await wallet.sign(faucetAddress, signDoc); +const { signed, signature } = await wallet.signAmino(faucetAddress, signDoc); const signedTx = makeStdTx(signed, signature); const broadcastResult = await client.broadcastTx(signedTx); ``` diff --git a/packages/cli/examples/delegate.ts b/packages/cli/examples/delegate.ts index 4d711861..a5d908b5 100644 --- a/packages/cli/examples/delegate.ts +++ b/packages/cli/examples/delegate.ts @@ -28,7 +28,7 @@ const { accountNumber, sequence } = await client.getSequence(senderAddress); console.log("Account/sequence:", accountNumber, sequence); const signDoc = makeSignDoc([msg], fee, chainId, memo, accountNumber, sequence); -const { signed, signature } = await wallet.sign(senderAddress, signDoc); +const { signed, signature } = await wallet.signAmino(senderAddress, signDoc); const signedTx = makeStdTx(signed, signature); const result = await client.broadcastTx(signedTx); diff --git a/packages/cli/src/cli.ts b/packages/cli/src/cli.ts index c0cb5a12..3d9adebb 100644 --- a/packages/cli/src/cli.ts +++ b/packages/cli/src/cli.ts @@ -176,7 +176,7 @@ export async function main(originalArgs: readonly string[]): Promise { gas: "89000000", }; const signDoc = makeSignDoc([], fee, "chain-xyz", "hello, world", 1, 2); - const { signed, signature } = await wallet.sign(address, signDoc); + const { signed, signature } = await wallet.signAmino(address, signDoc); assert(signed.memo === "hello, world"); const bechPubkey = "coralvalconspub1zcjduepqvxg72ccnl9r65fv0wn3amlk4sfzqfe2k36l073kjx2qyaf6sk23qw7j8wq"; From fca13eee8576db7b0827e742e046581a3dd97d95 Mon Sep 17 00:00:00 2001 From: willclarktech Date: Tue, 27 Oct 2020 17:14:54 +0100 Subject: [PATCH 27/28] root: Update CHANGELOG for stargate etc --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6be723bc..1cae3f29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,13 @@ @cosmjs/launchpad instead. - @cosmjs/launchpad: Add `Secp256k1Wallet` to manage a single raw secp256k1 keypair. +- @cosmjs/launchpad: `OfflineSigner` type’s `sign` method renamed `signAmino` + and `SignResponse` type renamed `AminoSignResponse`. +- @cosmjs/launchpad: `Secp256k1HdWallet.sign` method renamed `signAmino`. +- @cosmjs/launchpad-ledger: `LedgerSigner.sign` method renamed `signAmino`. +- @cosmjs/proto-signing: Add new package for handling transaction signing with + protobuf encoding. +- @cosmjs/stargate: Add new package for Cosmos SDK Stargate support. ## 0.23.1 (2020-10-27) From a2acf9e061df98e82b8394c29608756b8725c827 Mon Sep 17 00:00:00 2001 From: willclarktech Date: Wed, 28 Oct 2020 10:46:33 +0100 Subject: [PATCH 28/28] Tidy proto-signing and stargate after review --- packages/proto-signing/src/directsecp256k1wallet.spec.ts | 4 ++-- packages/proto-signing/src/signer.ts | 2 +- packages/proto-signing/src/signing.spec.ts | 4 ++-- packages/stargate/src/signingstargateclient.ts | 4 ++-- packages/stargate/src/stargateclient.searchtx.spec.ts | 4 ++-- packages/stargate/src/stargateclient.spec.ts | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/proto-signing/src/directsecp256k1wallet.spec.ts b/packages/proto-signing/src/directsecp256k1wallet.spec.ts index 1e51c72a..fc44ec2c 100644 --- a/packages/proto-signing/src/directsecp256k1wallet.spec.ts +++ b/packages/proto-signing/src/directsecp256k1wallet.spec.ts @@ -76,9 +76,9 @@ describe("DirectSecp256k1Wallet", () => { accountNumber, ); const signDocBytes = makeSignBytes(signDoc); - const signResponse = await wallet.signDirect(faucet.address, signDoc); + const { signature } = await wallet.signDirect(faucet.address, signDoc); const valid = await Secp256k1.verifySignature( - Secp256k1Signature.fromFixedLength(fromBase64(signResponse.signature.signature)), + Secp256k1Signature.fromFixedLength(fromBase64(signature.signature)), sha256(signDocBytes), pubkey.value, ); diff --git a/packages/proto-signing/src/signer.ts b/packages/proto-signing/src/signer.ts index 424eeae8..f1c205e9 100644 --- a/packages/proto-signing/src/signer.ts +++ b/packages/proto-signing/src/signer.ts @@ -22,5 +22,5 @@ export interface OfflineDirectSigner { export type OfflineSigner = OfflineAminoSigner | OfflineDirectSigner; export function isOfflineDirectSigner(signer: OfflineSigner): signer is OfflineDirectSigner { - return (signer as any).signDirect !== undefined; + return (signer as OfflineDirectSigner).signDirect !== undefined; } diff --git a/packages/proto-signing/src/signing.spec.ts b/packages/proto-signing/src/signing.spec.ts index 2a1ad8fd..342f46af 100644 --- a/packages/proto-signing/src/signing.spec.ts +++ b/packages/proto-signing/src/signing.spec.ts @@ -100,11 +100,11 @@ describe("signing", () => { const signDocBytes = makeSignBytes(signDoc); expect(toHex(signDocBytes)).toEqual(signBytes); - const signResponse = await wallet.signDirect(address, signDoc); + const { signature } = await wallet.signDirect(address, signDoc); const txRaw = TxRaw.create({ bodyBytes: txBodyBytes, authInfoBytes: authInfoBytes, - signatures: [fromBase64(signResponse.signature.signature)], + signatures: [fromBase64(signature.signature)], }); const txRawBytes = Uint8Array.from(TxRaw.encode(txRaw).finish()); const txBytesHex = toHex(txRawBytes); diff --git a/packages/stargate/src/signingstargateclient.ts b/packages/stargate/src/signingstargateclient.ts index e2dc7d41..d4bd344a 100644 --- a/packages/stargate/src/signingstargateclient.ts +++ b/packages/stargate/src/signingstargateclient.ts @@ -123,11 +123,11 @@ export class SigningStargateClient extends StargateClient { if (isOfflineDirectSigner(this.signer)) { const authInfoBytes = makeAuthInfoBytes([pubkeyAny], fee.amount, gasLimit, sequence); const signDoc = makeSignDoc(txBodyBytes, authInfoBytes, chainId, accountNumber); - const signResponse = await this.signer.signDirect(address, signDoc); + const { signature } = await this.signer.signDirect(address, signDoc); const txRaw = TxRaw.create({ bodyBytes: txBodyBytes, authInfoBytes: authInfoBytes, - signatures: [fromBase64(signResponse.signature.signature)], + signatures: [fromBase64(signature.signature)], }); const signedTx = Uint8Array.from(TxRaw.encode(txRaw).finish()); return this.broadcastTx(signedTx); diff --git a/packages/stargate/src/stargateclient.searchtx.spec.ts b/packages/stargate/src/stargateclient.searchtx.spec.ts index ae771457..ede5bcda 100644 --- a/packages/stargate/src/stargateclient.searchtx.spec.ts +++ b/packages/stargate/src/stargateclient.searchtx.spec.ts @@ -74,11 +74,11 @@ async function sendTokens( const chainId = await client.getChainId(); const signDoc = makeSignDoc(txBodyBytes, authInfoBytes, chainId, accountNumber); - const signResponse = await wallet.signDirect(walletAddress, signDoc); + const { signature } = await wallet.signDirect(walletAddress, signDoc); const txRaw = TxRaw.create({ bodyBytes: txBodyBytes, authInfoBytes: authInfoBytes, - signatures: [fromBase64(signResponse.signature.signature)], + signatures: [fromBase64(signature.signature)], }); const txRawBytes = Uint8Array.from(TxRaw.encode(txRaw).finish()); const broadcastResponse = await client.broadcastTx(txRawBytes); diff --git a/packages/stargate/src/stargateclient.spec.ts b/packages/stargate/src/stargateclient.spec.ts index c8d7357d..813d4006 100644 --- a/packages/stargate/src/stargateclient.spec.ts +++ b/packages/stargate/src/stargateclient.spec.ts @@ -296,11 +296,11 @@ describe("StargateClient", () => { const chainId = await client.getChainId(); const signDoc = makeSignDoc(txBodyBytes, authInfoBytes, chainId, accountNumber); - const signResponse = await wallet.signDirect(address, signDoc); + const { signature } = await wallet.signDirect(address, signDoc); const txRaw = TxRaw.create({ bodyBytes: txBodyBytes, authInfoBytes: authInfoBytes, - signatures: [fromBase64(signResponse.signature.signature)], + signatures: [fromBase64(signature.signature)], }); const txRawBytes = Uint8Array.from(TxRaw.encode(txRaw).finish()); const txResult = await client.broadcastTx(txRawBytes);