UNPKG

@cheqd/ts-proto

Version:

A TypeScript package for all transpiled cheqd ProtoBuf definitions.

1,629 lines (1,488 loc) 197 kB
// Code generated by protoc-gen-ts_proto. DO NOT EDIT. // versions: // protoc-gen-ts_proto v2.3.0 // protoc unknown // source: tendermint/abci/types.proto /* eslint-disable */ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { Timestamp } from "../../google/protobuf/timestamp.js"; import { PublicKey } from "../crypto/keys.js"; import { ProofOps } from "../crypto/proof.js"; import { ConsensusParams } from "../types/params.js"; import { BlockIDFlag, blockIDFlagFromJSON, blockIDFlagToJSON } from "../types/validator.js"; export enum CheckTxType { NEW = 0, RECHECK = 1, UNRECOGNIZED = -1, } export function checkTxTypeFromJSON(object: any): CheckTxType { switch (object) { case 0: case "NEW": return CheckTxType.NEW; case 1: case "RECHECK": return CheckTxType.RECHECK; case -1: case "UNRECOGNIZED": default: return CheckTxType.UNRECOGNIZED; } } export function checkTxTypeToJSON(object: CheckTxType): string { switch (object) { case CheckTxType.NEW: return "NEW"; case CheckTxType.RECHECK: return "RECHECK"; case CheckTxType.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } export enum MisbehaviorType { UNKNOWN = 0, DUPLICATE_VOTE = 1, LIGHT_CLIENT_ATTACK = 2, UNRECOGNIZED = -1, } export function misbehaviorTypeFromJSON(object: any): MisbehaviorType { switch (object) { case 0: case "UNKNOWN": return MisbehaviorType.UNKNOWN; case 1: case "DUPLICATE_VOTE": return MisbehaviorType.DUPLICATE_VOTE; case 2: case "LIGHT_CLIENT_ATTACK": return MisbehaviorType.LIGHT_CLIENT_ATTACK; case -1: case "UNRECOGNIZED": default: return MisbehaviorType.UNRECOGNIZED; } } export function misbehaviorTypeToJSON(object: MisbehaviorType): string { switch (object) { case MisbehaviorType.UNKNOWN: return "UNKNOWN"; case MisbehaviorType.DUPLICATE_VOTE: return "DUPLICATE_VOTE"; case MisbehaviorType.LIGHT_CLIENT_ATTACK: return "LIGHT_CLIENT_ATTACK"; case MisbehaviorType.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } export interface Request { echo?: RequestEcho | undefined; flush?: RequestFlush | undefined; info?: RequestInfo | undefined; initChain?: RequestInitChain | undefined; query?: RequestQuery | undefined; checkTx?: RequestCheckTx | undefined; commit?: RequestCommit | undefined; listSnapshots?: RequestListSnapshots | undefined; offerSnapshot?: RequestOfferSnapshot | undefined; loadSnapshotChunk?: RequestLoadSnapshotChunk | undefined; applySnapshotChunk?: RequestApplySnapshotChunk | undefined; prepareProposal?: RequestPrepareProposal | undefined; processProposal?: RequestProcessProposal | undefined; extendVote?: RequestExtendVote | undefined; verifyVoteExtension?: RequestVerifyVoteExtension | undefined; finalizeBlock?: RequestFinalizeBlock | undefined; } export interface RequestEcho { message: string; } export interface RequestFlush { } export interface RequestInfo { version: string; blockVersion: bigint; p2pVersion: bigint; abciVersion: string; } export interface RequestInitChain { time: Date | undefined; chainId: string; consensusParams: ConsensusParams | undefined; validators: ValidatorUpdate[]; appStateBytes: Uint8Array; initialHeight: bigint; } export interface RequestQuery { data: Uint8Array; path: string; height: bigint; prove: boolean; } export interface RequestCheckTx { tx: Uint8Array; type: CheckTxType; } export interface RequestCommit { } /** lists available snapshots */ export interface RequestListSnapshots { } /** offers a snapshot to the application */ export interface RequestOfferSnapshot { /** snapshot offered by peers */ snapshot: | Snapshot | undefined; /** light client-verified app hash for snapshot height */ appHash: Uint8Array; } /** loads a snapshot chunk */ export interface RequestLoadSnapshotChunk { height: bigint; format: number; chunk: number; } /** Applies a snapshot chunk */ export interface RequestApplySnapshotChunk { index: number; chunk: Uint8Array; sender: string; } export interface RequestPrepareProposal { /** the modified transactions cannot exceed this size. */ maxTxBytes: bigint; /** * txs is an array of transactions that will be included in a block, * sent to the app for possible modifications. */ txs: Uint8Array[]; localLastCommit: ExtendedCommitInfo | undefined; misbehavior: Misbehavior[]; height: bigint; time: Date | undefined; nextValidatorsHash: Uint8Array; /** address of the public key of the validator proposing the block. */ proposerAddress: Uint8Array; } export interface RequestProcessProposal { txs: Uint8Array[]; proposedLastCommit: CommitInfo | undefined; misbehavior: Misbehavior[]; /** hash is the merkle root hash of the fields of the proposed block. */ hash: Uint8Array; height: bigint; time: Date | undefined; nextValidatorsHash: Uint8Array; /** address of the public key of the original proposer of the block. */ proposerAddress: Uint8Array; } /** Extends a vote with application-injected data */ export interface RequestExtendVote { /** the hash of the block that this vote may be referring to */ hash: Uint8Array; /** the height of the extended vote */ height: bigint; /** info of the block that this vote may be referring to */ time: Date | undefined; txs: Uint8Array[]; proposedLastCommit: CommitInfo | undefined; misbehavior: Misbehavior[]; nextValidatorsHash: Uint8Array; /** address of the public key of the original proposer of the block. */ proposerAddress: Uint8Array; } /** Verify the vote extension */ export interface RequestVerifyVoteExtension { /** the hash of the block that this received vote corresponds to */ hash: Uint8Array; /** the validator that signed the vote extension */ validatorAddress: Uint8Array; height: bigint; voteExtension: Uint8Array; } export interface RequestFinalizeBlock { txs: Uint8Array[]; decidedLastCommit: CommitInfo | undefined; misbehavior: Misbehavior[]; /** hash is the merkle root hash of the fields of the decided block. */ hash: Uint8Array; height: bigint; time: Date | undefined; nextValidatorsHash: Uint8Array; /** proposer_address is the address of the public key of the original proposer of the block. */ proposerAddress: Uint8Array; } export interface Response { exception?: ResponseException | undefined; echo?: ResponseEcho | undefined; flush?: ResponseFlush | undefined; info?: ResponseInfo | undefined; initChain?: ResponseInitChain | undefined; query?: ResponseQuery | undefined; checkTx?: ResponseCheckTx | undefined; commit?: ResponseCommit | undefined; listSnapshots?: ResponseListSnapshots | undefined; offerSnapshot?: ResponseOfferSnapshot | undefined; loadSnapshotChunk?: ResponseLoadSnapshotChunk | undefined; applySnapshotChunk?: ResponseApplySnapshotChunk | undefined; prepareProposal?: ResponsePrepareProposal | undefined; processProposal?: ResponseProcessProposal | undefined; extendVote?: ResponseExtendVote | undefined; verifyVoteExtension?: ResponseVerifyVoteExtension | undefined; finalizeBlock?: ResponseFinalizeBlock | undefined; } /** nondeterministic */ export interface ResponseException { error: string; } export interface ResponseEcho { message: string; } export interface ResponseFlush { } export interface ResponseInfo { data: string; version: string; appVersion: bigint; lastBlockHeight: bigint; lastBlockAppHash: Uint8Array; } export interface ResponseInitChain { consensusParams: ConsensusParams | undefined; validators: ValidatorUpdate[]; appHash: Uint8Array; } export interface ResponseQuery { code: number; /** bytes data = 2; // use "value" instead. */ log: string; /** nondeterministic */ info: string; index: bigint; key: Uint8Array; value: Uint8Array; proofOps: ProofOps | undefined; height: bigint; codespace: string; } export interface ResponseCheckTx { code: number; data: Uint8Array; /** nondeterministic */ log: string; /** nondeterministic */ info: string; gasWanted: bigint; gasUsed: bigint; events: Event[]; codespace: string; } export interface ResponseCommit { retainHeight: bigint; } export interface ResponseListSnapshots { snapshots: Snapshot[]; } export interface ResponseOfferSnapshot { result: ResponseOfferSnapshot_Result; } export enum ResponseOfferSnapshot_Result { /** UNKNOWN - Unknown result, abort all snapshot restoration */ UNKNOWN = 0, /** ACCEPT - Snapshot accepted, apply chunks */ ACCEPT = 1, /** ABORT - Abort all snapshot restoration */ ABORT = 2, /** REJECT - Reject this specific snapshot, try others */ REJECT = 3, /** REJECT_FORMAT - Reject all snapshots of this format, try others */ REJECT_FORMAT = 4, /** REJECT_SENDER - Reject all snapshots from the sender(s), try others */ REJECT_SENDER = 5, UNRECOGNIZED = -1, } export function responseOfferSnapshot_ResultFromJSON(object: any): ResponseOfferSnapshot_Result { switch (object) { case 0: case "UNKNOWN": return ResponseOfferSnapshot_Result.UNKNOWN; case 1: case "ACCEPT": return ResponseOfferSnapshot_Result.ACCEPT; case 2: case "ABORT": return ResponseOfferSnapshot_Result.ABORT; case 3: case "REJECT": return ResponseOfferSnapshot_Result.REJECT; case 4: case "REJECT_FORMAT": return ResponseOfferSnapshot_Result.REJECT_FORMAT; case 5: case "REJECT_SENDER": return ResponseOfferSnapshot_Result.REJECT_SENDER; case -1: case "UNRECOGNIZED": default: return ResponseOfferSnapshot_Result.UNRECOGNIZED; } } export function responseOfferSnapshot_ResultToJSON(object: ResponseOfferSnapshot_Result): string { switch (object) { case ResponseOfferSnapshot_Result.UNKNOWN: return "UNKNOWN"; case ResponseOfferSnapshot_Result.ACCEPT: return "ACCEPT"; case ResponseOfferSnapshot_Result.ABORT: return "ABORT"; case ResponseOfferSnapshot_Result.REJECT: return "REJECT"; case ResponseOfferSnapshot_Result.REJECT_FORMAT: return "REJECT_FORMAT"; case ResponseOfferSnapshot_Result.REJECT_SENDER: return "REJECT_SENDER"; case ResponseOfferSnapshot_Result.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } export interface ResponseLoadSnapshotChunk { chunk: Uint8Array; } export interface ResponseApplySnapshotChunk { result: ResponseApplySnapshotChunk_Result; /** Chunks to refetch and reapply */ refetchChunks: number[]; /** Chunk senders to reject and ban */ rejectSenders: string[]; } export enum ResponseApplySnapshotChunk_Result { /** UNKNOWN - Unknown result, abort all snapshot restoration */ UNKNOWN = 0, /** ACCEPT - Chunk successfully accepted */ ACCEPT = 1, /** ABORT - Abort all snapshot restoration */ ABORT = 2, /** RETRY - Retry chunk (combine with refetch and reject) */ RETRY = 3, /** RETRY_SNAPSHOT - Retry snapshot (combine with refetch and reject) */ RETRY_SNAPSHOT = 4, /** REJECT_SNAPSHOT - Reject this snapshot, try others */ REJECT_SNAPSHOT = 5, UNRECOGNIZED = -1, } export function responseApplySnapshotChunk_ResultFromJSON(object: any): ResponseApplySnapshotChunk_Result { switch (object) { case 0: case "UNKNOWN": return ResponseApplySnapshotChunk_Result.UNKNOWN; case 1: case "ACCEPT": return ResponseApplySnapshotChunk_Result.ACCEPT; case 2: case "ABORT": return ResponseApplySnapshotChunk_Result.ABORT; case 3: case "RETRY": return ResponseApplySnapshotChunk_Result.RETRY; case 4: case "RETRY_SNAPSHOT": return ResponseApplySnapshotChunk_Result.RETRY_SNAPSHOT; case 5: case "REJECT_SNAPSHOT": return ResponseApplySnapshotChunk_Result.REJECT_SNAPSHOT; case -1: case "UNRECOGNIZED": default: return ResponseApplySnapshotChunk_Result.UNRECOGNIZED; } } export function responseApplySnapshotChunk_ResultToJSON(object: ResponseApplySnapshotChunk_Result): string { switch (object) { case ResponseApplySnapshotChunk_Result.UNKNOWN: return "UNKNOWN"; case ResponseApplySnapshotChunk_Result.ACCEPT: return "ACCEPT"; case ResponseApplySnapshotChunk_Result.ABORT: return "ABORT"; case ResponseApplySnapshotChunk_Result.RETRY: return "RETRY"; case ResponseApplySnapshotChunk_Result.RETRY_SNAPSHOT: return "RETRY_SNAPSHOT"; case ResponseApplySnapshotChunk_Result.REJECT_SNAPSHOT: return "REJECT_SNAPSHOT"; case ResponseApplySnapshotChunk_Result.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } export interface ResponsePrepareProposal { txs: Uint8Array[]; } export interface ResponseProcessProposal { status: ResponseProcessProposal_ProposalStatus; } export enum ResponseProcessProposal_ProposalStatus { UNKNOWN = 0, ACCEPT = 1, REJECT = 2, UNRECOGNIZED = -1, } export function responseProcessProposal_ProposalStatusFromJSON(object: any): ResponseProcessProposal_ProposalStatus { switch (object) { case 0: case "UNKNOWN": return ResponseProcessProposal_ProposalStatus.UNKNOWN; case 1: case "ACCEPT": return ResponseProcessProposal_ProposalStatus.ACCEPT; case 2: case "REJECT": return ResponseProcessProposal_ProposalStatus.REJECT; case -1: case "UNRECOGNIZED": default: return ResponseProcessProposal_ProposalStatus.UNRECOGNIZED; } } export function responseProcessProposal_ProposalStatusToJSON(object: ResponseProcessProposal_ProposalStatus): string { switch (object) { case ResponseProcessProposal_ProposalStatus.UNKNOWN: return "UNKNOWN"; case ResponseProcessProposal_ProposalStatus.ACCEPT: return "ACCEPT"; case ResponseProcessProposal_ProposalStatus.REJECT: return "REJECT"; case ResponseProcessProposal_ProposalStatus.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } export interface ResponseExtendVote { voteExtension: Uint8Array; } export interface ResponseVerifyVoteExtension { status: ResponseVerifyVoteExtension_VerifyStatus; } export enum ResponseVerifyVoteExtension_VerifyStatus { UNKNOWN = 0, ACCEPT = 1, /** * REJECT - Rejecting the vote extension will reject the entire precommit by the sender. * Incorrectly implementing this thus has liveness implications as it may affect * CometBFT's ability to receive 2/3+ valid votes to finalize the block. * Honest nodes should never be rejected. */ REJECT = 2, UNRECOGNIZED = -1, } export function responseVerifyVoteExtension_VerifyStatusFromJSON( object: any, ): ResponseVerifyVoteExtension_VerifyStatus { switch (object) { case 0: case "UNKNOWN": return ResponseVerifyVoteExtension_VerifyStatus.UNKNOWN; case 1: case "ACCEPT": return ResponseVerifyVoteExtension_VerifyStatus.ACCEPT; case 2: case "REJECT": return ResponseVerifyVoteExtension_VerifyStatus.REJECT; case -1: case "UNRECOGNIZED": default: return ResponseVerifyVoteExtension_VerifyStatus.UNRECOGNIZED; } } export function responseVerifyVoteExtension_VerifyStatusToJSON( object: ResponseVerifyVoteExtension_VerifyStatus, ): string { switch (object) { case ResponseVerifyVoteExtension_VerifyStatus.UNKNOWN: return "UNKNOWN"; case ResponseVerifyVoteExtension_VerifyStatus.ACCEPT: return "ACCEPT"; case ResponseVerifyVoteExtension_VerifyStatus.REJECT: return "REJECT"; case ResponseVerifyVoteExtension_VerifyStatus.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } export interface ResponseFinalizeBlock { /** set of block events emmitted as part of executing the block */ events: Event[]; /** * the result of executing each transaction including the events * the particular transction emitted. This should match the order * of the transactions delivered in the block itself */ txResults: ExecTxResult[]; /** a list of updates to the validator set. These will reflect the validator set at current height + 2. */ validatorUpdates: ValidatorUpdate[]; /** updates to the consensus params, if any. */ consensusParamUpdates: | ConsensusParams | undefined; /** * app_hash is the hash of the applications' state which is used to confirm that execution of the transactions was * deterministic. It is up to the application to decide which algorithm to use. */ appHash: Uint8Array; } export interface CommitInfo { round: number; votes: VoteInfo[]; } /** * ExtendedCommitInfo is similar to CommitInfo except that it is only used in * the PrepareProposal request such that CometBFT can provide vote extensions * to the application. */ export interface ExtendedCommitInfo { /** The round at which the block proposer decided in the previous height. */ round: number; /** * List of validators' addresses in the last validator set with their voting * information, including vote extensions. */ votes: ExtendedVoteInfo[]; } /** * Event allows application developers to attach additional information to * ResponseFinalizeBlock and ResponseCheckTx. * Later, transactions may be queried using these events. */ export interface Event { type: string; attributes: EventAttribute[]; } /** EventAttribute is a single key-value pair, associated with an event. */ export interface EventAttribute { key: string; value: string; /** nondeterministic */ index: boolean; } /** * ExecTxResult contains results of executing one individual transaction. * * * Its structure is equivalent to #ResponseDeliverTx which will be deprecated/deleted */ export interface ExecTxResult { code: number; data: Uint8Array; /** nondeterministic */ log: string; /** nondeterministic */ info: string; gasWanted: bigint; gasUsed: bigint; /** nondeterministic */ events: Event[]; codespace: string; } /** * TxResult contains results of executing the transaction. * * One usage is indexing transaction results. */ export interface TxResult { height: bigint; index: number; tx: Uint8Array; result: ExecTxResult | undefined; } export interface Validator { /** The first 20 bytes of SHA256(public key) */ address: Uint8Array; /** PubKey pub_key = 2 [(gogoproto.nullable)=false]; */ power: bigint; } export interface ValidatorUpdate { pubKey: PublicKey | undefined; power: bigint; } export interface VoteInfo { validator: Validator | undefined; blockIdFlag: BlockIDFlag; } export interface ExtendedVoteInfo { /** The validator that sent the vote. */ validator: | Validator | undefined; /** Non-deterministic extension provided by the sending validator's application. */ voteExtension: Uint8Array; /** Vote extension signature created by CometBFT */ extensionSignature: Uint8Array; /** block_id_flag indicates whether the validator voted for a block, nil, or did not vote at all */ blockIdFlag: BlockIDFlag; } export interface Misbehavior { type: MisbehaviorType; /** The offending validator */ validator: | Validator | undefined; /** The height when the offense occurred */ height: bigint; /** The corresponding time where the offense occurred */ time: | Date | undefined; /** * Total voting power of the validator set in case the ABCI application does * not store historical validators. * https://github.com/tendermint/tendermint/issues/4581 */ totalVotingPower: bigint; } export interface Snapshot { /** The height at which the snapshot was taken */ height: bigint; /** The application-specific snapshot format */ format: number; /** Number of chunks in the snapshot */ chunks: number; /** Arbitrary snapshot hash, equal only if identical */ hash: Uint8Array; /** Arbitrary application metadata */ metadata: Uint8Array; } function createBaseRequest(): Request { return { echo: undefined, flush: undefined, info: undefined, initChain: undefined, query: undefined, checkTx: undefined, commit: undefined, listSnapshots: undefined, offerSnapshot: undefined, loadSnapshotChunk: undefined, applySnapshotChunk: undefined, prepareProposal: undefined, processProposal: undefined, extendVote: undefined, verifyVoteExtension: undefined, finalizeBlock: undefined, }; } export const Request: MessageFns<Request> = { encode(message: Request, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.echo !== undefined) { RequestEcho.encode(message.echo, writer.uint32(10).fork()).join(); } if (message.flush !== undefined) { RequestFlush.encode(message.flush, writer.uint32(18).fork()).join(); } if (message.info !== undefined) { RequestInfo.encode(message.info, writer.uint32(26).fork()).join(); } if (message.initChain !== undefined) { RequestInitChain.encode(message.initChain, writer.uint32(42).fork()).join(); } if (message.query !== undefined) { RequestQuery.encode(message.query, writer.uint32(50).fork()).join(); } if (message.checkTx !== undefined) { RequestCheckTx.encode(message.checkTx, writer.uint32(66).fork()).join(); } if (message.commit !== undefined) { RequestCommit.encode(message.commit, writer.uint32(90).fork()).join(); } if (message.listSnapshots !== undefined) { RequestListSnapshots.encode(message.listSnapshots, writer.uint32(98).fork()).join(); } if (message.offerSnapshot !== undefined) { RequestOfferSnapshot.encode(message.offerSnapshot, writer.uint32(106).fork()).join(); } if (message.loadSnapshotChunk !== undefined) { RequestLoadSnapshotChunk.encode(message.loadSnapshotChunk, writer.uint32(114).fork()).join(); } if (message.applySnapshotChunk !== undefined) { RequestApplySnapshotChunk.encode(message.applySnapshotChunk, writer.uint32(122).fork()).join(); } if (message.prepareProposal !== undefined) { RequestPrepareProposal.encode(message.prepareProposal, writer.uint32(130).fork()).join(); } if (message.processProposal !== undefined) { RequestProcessProposal.encode(message.processProposal, writer.uint32(138).fork()).join(); } if (message.extendVote !== undefined) { RequestExtendVote.encode(message.extendVote, writer.uint32(146).fork()).join(); } if (message.verifyVoteExtension !== undefined) { RequestVerifyVoteExtension.encode(message.verifyVoteExtension, writer.uint32(154).fork()).join(); } if (message.finalizeBlock !== undefined) { RequestFinalizeBlock.encode(message.finalizeBlock, writer.uint32(162).fork()).join(); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): Request { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.echo = RequestEcho.decode(reader, reader.uint32()); continue; } case 2: { if (tag !== 18) { break; } message.flush = RequestFlush.decode(reader, reader.uint32()); continue; } case 3: { if (tag !== 26) { break; } message.info = RequestInfo.decode(reader, reader.uint32()); continue; } case 5: { if (tag !== 42) { break; } message.initChain = RequestInitChain.decode(reader, reader.uint32()); continue; } case 6: { if (tag !== 50) { break; } message.query = RequestQuery.decode(reader, reader.uint32()); continue; } case 8: { if (tag !== 66) { break; } message.checkTx = RequestCheckTx.decode(reader, reader.uint32()); continue; } case 11: { if (tag !== 90) { break; } message.commit = RequestCommit.decode(reader, reader.uint32()); continue; } case 12: { if (tag !== 98) { break; } message.listSnapshots = RequestListSnapshots.decode(reader, reader.uint32()); continue; } case 13: { if (tag !== 106) { break; } message.offerSnapshot = RequestOfferSnapshot.decode(reader, reader.uint32()); continue; } case 14: { if (tag !== 114) { break; } message.loadSnapshotChunk = RequestLoadSnapshotChunk.decode(reader, reader.uint32()); continue; } case 15: { if (tag !== 122) { break; } message.applySnapshotChunk = RequestApplySnapshotChunk.decode(reader, reader.uint32()); continue; } case 16: { if (tag !== 130) { break; } message.prepareProposal = RequestPrepareProposal.decode(reader, reader.uint32()); continue; } case 17: { if (tag !== 138) { break; } message.processProposal = RequestProcessProposal.decode(reader, reader.uint32()); continue; } case 18: { if (tag !== 146) { break; } message.extendVote = RequestExtendVote.decode(reader, reader.uint32()); continue; } case 19: { if (tag !== 154) { break; } message.verifyVoteExtension = RequestVerifyVoteExtension.decode(reader, reader.uint32()); continue; } case 20: { if (tag !== 162) { break; } message.finalizeBlock = RequestFinalizeBlock.decode(reader, reader.uint32()); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object: any): Request { return { echo: isSet(object.echo) ? RequestEcho.fromJSON(object.echo) : undefined, flush: isSet(object.flush) ? RequestFlush.fromJSON(object.flush) : undefined, info: isSet(object.info) ? RequestInfo.fromJSON(object.info) : undefined, initChain: isSet(object.initChain) ? RequestInitChain.fromJSON(object.initChain) : undefined, query: isSet(object.query) ? RequestQuery.fromJSON(object.query) : undefined, checkTx: isSet(object.checkTx) ? RequestCheckTx.fromJSON(object.checkTx) : undefined, commit: isSet(object.commit) ? RequestCommit.fromJSON(object.commit) : undefined, listSnapshots: isSet(object.listSnapshots) ? RequestListSnapshots.fromJSON(object.listSnapshots) : undefined, offerSnapshot: isSet(object.offerSnapshot) ? RequestOfferSnapshot.fromJSON(object.offerSnapshot) : undefined, loadSnapshotChunk: isSet(object.loadSnapshotChunk) ? RequestLoadSnapshotChunk.fromJSON(object.loadSnapshotChunk) : undefined, applySnapshotChunk: isSet(object.applySnapshotChunk) ? RequestApplySnapshotChunk.fromJSON(object.applySnapshotChunk) : undefined, prepareProposal: isSet(object.prepareProposal) ? RequestPrepareProposal.fromJSON(object.prepareProposal) : undefined, processProposal: isSet(object.processProposal) ? RequestProcessProposal.fromJSON(object.processProposal) : undefined, extendVote: isSet(object.extendVote) ? RequestExtendVote.fromJSON(object.extendVote) : undefined, verifyVoteExtension: isSet(object.verifyVoteExtension) ? RequestVerifyVoteExtension.fromJSON(object.verifyVoteExtension) : undefined, finalizeBlock: isSet(object.finalizeBlock) ? RequestFinalizeBlock.fromJSON(object.finalizeBlock) : undefined, }; }, toJSON(message: Request): unknown { const obj: any = {}; if (message.echo !== undefined) { obj.echo = RequestEcho.toJSON(message.echo); } if (message.flush !== undefined) { obj.flush = RequestFlush.toJSON(message.flush); } if (message.info !== undefined) { obj.info = RequestInfo.toJSON(message.info); } if (message.initChain !== undefined) { obj.initChain = RequestInitChain.toJSON(message.initChain); } if (message.query !== undefined) { obj.query = RequestQuery.toJSON(message.query); } if (message.checkTx !== undefined) { obj.checkTx = RequestCheckTx.toJSON(message.checkTx); } if (message.commit !== undefined) { obj.commit = RequestCommit.toJSON(message.commit); } if (message.listSnapshots !== undefined) { obj.listSnapshots = RequestListSnapshots.toJSON(message.listSnapshots); } if (message.offerSnapshot !== undefined) { obj.offerSnapshot = RequestOfferSnapshot.toJSON(message.offerSnapshot); } if (message.loadSnapshotChunk !== undefined) { obj.loadSnapshotChunk = RequestLoadSnapshotChunk.toJSON(message.loadSnapshotChunk); } if (message.applySnapshotChunk !== undefined) { obj.applySnapshotChunk = RequestApplySnapshotChunk.toJSON(message.applySnapshotChunk); } if (message.prepareProposal !== undefined) { obj.prepareProposal = RequestPrepareProposal.toJSON(message.prepareProposal); } if (message.processProposal !== undefined) { obj.processProposal = RequestProcessProposal.toJSON(message.processProposal); } if (message.extendVote !== undefined) { obj.extendVote = RequestExtendVote.toJSON(message.extendVote); } if (message.verifyVoteExtension !== undefined) { obj.verifyVoteExtension = RequestVerifyVoteExtension.toJSON(message.verifyVoteExtension); } if (message.finalizeBlock !== undefined) { obj.finalizeBlock = RequestFinalizeBlock.toJSON(message.finalizeBlock); } return obj; }, create<I extends Exact<DeepPartial<Request>, I>>(base?: I): Request { return Request.fromPartial(base ?? ({} as any)); }, fromPartial<I extends Exact<DeepPartial<Request>, I>>(object: I): Request { const message = createBaseRequest(); message.echo = (object.echo !== undefined && object.echo !== null) ? RequestEcho.fromPartial(object.echo) : undefined; message.flush = (object.flush !== undefined && object.flush !== null) ? RequestFlush.fromPartial(object.flush) : undefined; message.info = (object.info !== undefined && object.info !== null) ? RequestInfo.fromPartial(object.info) : undefined; message.initChain = (object.initChain !== undefined && object.initChain !== null) ? RequestInitChain.fromPartial(object.initChain) : undefined; message.query = (object.query !== undefined && object.query !== null) ? RequestQuery.fromPartial(object.query) : undefined; message.checkTx = (object.checkTx !== undefined && object.checkTx !== null) ? RequestCheckTx.fromPartial(object.checkTx) : undefined; message.commit = (object.commit !== undefined && object.commit !== null) ? RequestCommit.fromPartial(object.commit) : undefined; message.listSnapshots = (object.listSnapshots !== undefined && object.listSnapshots !== null) ? RequestListSnapshots.fromPartial(object.listSnapshots) : undefined; message.offerSnapshot = (object.offerSnapshot !== undefined && object.offerSnapshot !== null) ? RequestOfferSnapshot.fromPartial(object.offerSnapshot) : undefined; message.loadSnapshotChunk = (object.loadSnapshotChunk !== undefined && object.loadSnapshotChunk !== null) ? RequestLoadSnapshotChunk.fromPartial(object.loadSnapshotChunk) : undefined; message.applySnapshotChunk = (object.applySnapshotChunk !== undefined && object.applySnapshotChunk !== null) ? RequestApplySnapshotChunk.fromPartial(object.applySnapshotChunk) : undefined; message.prepareProposal = (object.prepareProposal !== undefined && object.prepareProposal !== null) ? RequestPrepareProposal.fromPartial(object.prepareProposal) : undefined; message.processProposal = (object.processProposal !== undefined && object.processProposal !== null) ? RequestProcessProposal.fromPartial(object.processProposal) : undefined; message.extendVote = (object.extendVote !== undefined && object.extendVote !== null) ? RequestExtendVote.fromPartial(object.extendVote) : undefined; message.verifyVoteExtension = (object.verifyVoteExtension !== undefined && object.verifyVoteExtension !== null) ? RequestVerifyVoteExtension.fromPartial(object.verifyVoteExtension) : undefined; message.finalizeBlock = (object.finalizeBlock !== undefined && object.finalizeBlock !== null) ? RequestFinalizeBlock.fromPartial(object.finalizeBlock) : undefined; return message; }, }; function createBaseRequestEcho(): RequestEcho { return { message: "" }; } export const RequestEcho: MessageFns<RequestEcho> = { encode(message: RequestEcho, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.message !== "") { writer.uint32(10).string(message.message); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): RequestEcho { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseRequestEcho(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.message = reader.string(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object: any): RequestEcho { return { message: isSet(object.message) ? globalThis.String(object.message) : "" }; }, toJSON(message: RequestEcho): unknown { const obj: any = {}; if (message.message !== "") { obj.message = message.message; } return obj; }, create<I extends Exact<DeepPartial<RequestEcho>, I>>(base?: I): RequestEcho { return RequestEcho.fromPartial(base ?? ({} as any)); }, fromPartial<I extends Exact<DeepPartial<RequestEcho>, I>>(object: I): RequestEcho { const message = createBaseRequestEcho(); message.message = object.message ?? ""; return message; }, }; function createBaseRequestFlush(): RequestFlush { return {}; } export const RequestFlush: MessageFns<RequestFlush> = { encode(_: RequestFlush, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): RequestFlush { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseRequestFlush(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(_: any): RequestFlush { return {}; }, toJSON(_: RequestFlush): unknown { const obj: any = {}; return obj; }, create<I extends Exact<DeepPartial<RequestFlush>, I>>(base?: I): RequestFlush { return RequestFlush.fromPartial(base ?? ({} as any)); }, fromPartial<I extends Exact<DeepPartial<RequestFlush>, I>>(_: I): RequestFlush { const message = createBaseRequestFlush(); return message; }, }; function createBaseRequestInfo(): RequestInfo { return { version: "", blockVersion: 0n, p2pVersion: 0n, abciVersion: "" }; } export const RequestInfo: MessageFns<RequestInfo> = { encode(message: RequestInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.version !== "") { writer.uint32(10).string(message.version); } if (message.blockVersion !== 0n) { if (BigInt.asUintN(64, message.blockVersion) !== message.blockVersion) { throw new globalThis.Error("value provided for field message.blockVersion of type uint64 too large"); } writer.uint32(16).uint64(message.blockVersion); } if (message.p2pVersion !== 0n) { if (BigInt.asUintN(64, message.p2pVersion) !== message.p2pVersion) { throw new globalThis.Error("value provided for field message.p2pVersion of type uint64 too large"); } writer.uint32(24).uint64(message.p2pVersion); } if (message.abciVersion !== "") { writer.uint32(34).string(message.abciVersion); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): RequestInfo { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseRequestInfo(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.version = reader.string(); continue; } case 2: { if (tag !== 16) { break; } message.blockVersion = reader.uint64() as bigint; continue; } case 3: { if (tag !== 24) { break; } message.p2pVersion = reader.uint64() as bigint; continue; } case 4: { if (tag !== 34) { break; } message.abciVersion = reader.string(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object: any): RequestInfo { return { version: isSet(object.version) ? globalThis.String(object.version) : "", blockVersion: isSet(object.blockVersion) ? BigInt(object.blockVersion) : 0n, p2pVersion: isSet(object.p2pVersion) ? BigInt(object.p2pVersion) : 0n, abciVersion: isSet(object.abciVersion) ? globalThis.String(object.abciVersion) : "", }; }, toJSON(message: RequestInfo): unknown { const obj: any = {}; if (message.version !== "") { obj.version = message.version; } if (message.blockVersion !== 0n) { obj.blockVersion = message.blockVersion.toString(); } if (message.p2pVersion !== 0n) { obj.p2pVersion = message.p2pVersion.toString(); } if (message.abciVersion !== "") { obj.abciVersion = message.abciVersion; } return obj; }, create<I extends Exact<DeepPartial<RequestInfo>, I>>(base?: I): RequestInfo { return RequestInfo.fromPartial(base ?? ({} as any)); }, fromPartial<I extends Exact<DeepPartial<RequestInfo>, I>>(object: I): RequestInfo { const message = createBaseRequestInfo(); message.version = object.version ?? ""; message.blockVersion = object.blockVersion ?? 0n; message.p2pVersion = object.p2pVersion ?? 0n; message.abciVersion = object.abciVersion ?? ""; return message; }, }; function createBaseRequestInitChain(): RequestInitChain { return { time: undefined, chainId: "", consensusParams: undefined, validators: [], appStateBytes: new Uint8Array(0), initialHeight: 0n, }; } export const RequestInitChain: MessageFns<RequestInitChain> = { encode(message: RequestInitChain, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.time !== undefined) { Timestamp.encode(toTimestamp(message.time), writer.uint32(10).fork()).join(); } if (message.chainId !== "") { writer.uint32(18).string(message.chainId); } if (message.consensusParams !== undefined) { ConsensusParams.encode(message.consensusParams, writer.uint32(26).fork()).join(); } for (const v of message.validators) { ValidatorUpdate.encode(v!, writer.uint32(34).fork()).join(); } if (message.appStateBytes.length !== 0) { writer.uint32(42).bytes(message.appStateBytes); } if (message.initialHeight !== 0n) { if (BigInt.asIntN(64, message.initialHeight) !== message.initialHeight) { throw new globalThis.Error("value provided for field message.initialHeight of type int64 too large"); } writer.uint32(48).int64(message.initialHeight); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): RequestInitChain { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseRequestInitChain(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); continue; } case 2: { if (tag !== 18) { break; } message.chainId = reader.string(); continue; } case 3: { if (tag !== 26) { break; } message.consensusParams = ConsensusParams.decode(reader, reader.uint32()); continue; } case 4: { if (tag !== 34) { break; } message.validators.push(ValidatorUpdate.decode(reader, reader.uint32())); continue; } case 5: { if (tag !== 42) { break; } message.appStateBytes = reader.bytes(); continue; } case 6: { if (tag !== 48) { break; } message.initialHeight = reader.int64() as bigint; continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object: any): RequestInitChain { return { time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, chainId: isSet(object.chainId) ? globalThis.String(object.chainId) : "", consensusParams: isSet(object.consensusParams) ? ConsensusParams.fromJSON(object.consensusParams) : undefined, validators: globalThis.Array.isArray(object?.validators) ? object.validators.map((e: any) => ValidatorUpdate.fromJSON(e)) : [], appStateBytes: isSet(object.appStateBytes) ? bytesFromBase64(object.appStateBytes) : new Uint8Array(0), initialHeight: isSet(object.initialHeight) ? BigInt(object.initialHeight) : 0n, }; }, toJSON(message: RequestInitChain): unknown { const obj: any = {}; if (message.time !== undefined) { obj.time = message.time.toISOString(); } if (message.chainId !== "") { obj.chainId = message.chainId; } if (message.consensusParams !== undefined) { obj.consensusParams = ConsensusParams.toJSON(message.consensusParams); } if (message.validators?.length) { obj.validators = message.validators.map((e) => ValidatorUpdate.toJSON(e)); } if (message.appStateBytes.length !== 0) { obj.appStateBytes = base64FromBytes(message.appStateBytes); } if (message.initialHeight !== 0n) { obj.initialHeight = message.initialHeight.toString(); } return obj; }, create<I extends Exact<DeepPartial<RequestInitChain>, I>>(base?: I): RequestInitChain { return RequestInitChain.fromPartial(base ?? ({} as any)); }, fromPartial<I extends Exact<DeepPartial<RequestInitChain>, I>>(object: I): RequestInitChain { const message = createBaseRequestInitChain(); message.time = object.time ?? undefined; message.chainId = object.chainId ?? ""; message.consensusParams = (object.consensusParams !== undefined && object.consensusParams !== null) ? ConsensusParams.fromPartial(object.consensusParams) : undefined; message.validators = object.validators?.map((e) => ValidatorUpdate.fromPartial(e)) || []; message.appStateBytes = object.appStateBytes ?? new Uint8Array(0); message.initialHeight = object.initialHeight ?? 0n; return message; }, }; function createBaseRequestQuery(): RequestQuery { return { data: new Uint8Array(0), path: "", height: 0n, prove: false }; } export const RequestQuery: MessageFns<RequestQuery> = { encode(message: RequestQuery, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.data.length !== 0) { writer.uint32(10).bytes(message.data); } if (message.path !== "") { writer.uint32(18).string(message.path); } if (message.height !== 0n) { if (BigInt.asIntN(64, message.height) !== message.height) { throw new globalThis.Error("value provided for field message.height of type int64 too large"); } writer.uint32(24).int64(message.height); } if (message.prove !== false) { writer.uint32(32).bool(message.prove); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): RequestQuery { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseRequestQuery(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.data = reader.bytes(); continue; } case 2: { if (tag !== 18) { break; } message.path = reader.string(); continue; } case 3: { if (tag !== 24) { break; } message.height = reader.int64() as bigint; continue; } case 4: { if (tag !== 32) { break; } message.prove = reader.bool(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object: any): RequestQuery { return { data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), path: isSet(object.path) ? globalThis.String(object.path) : "", height: isSet(object.height) ? BigInt(object.height) : 0n, prove: isSet(object.prove) ? globalThis.Boolean(object.prove) : false, }; }, toJSON(message: RequestQuery): unknown { const obj: any = {}; if (message.data.length !== 0) { obj.data = base64FromBytes(message.data); } if (message.path !== "") { obj.path = message.path; } if (message.height !== 0n) { obj.height = message.height.toString(); } if (message.prove !== false) { obj.prove = message.prove; } return obj; }, create<I extends Exact<DeepPartial<RequestQuery>, I>>(base?: I): RequestQuery { return RequestQuery.fromPartial(base ?? ({} as any)); }, fromPartial<I extends Exact<DeepPartial<RequestQuery>, I>>(object: I): RequestQuery { const message = createBaseRequestQuery(); message.data = object.data ?? new Uint8Array(0); message.path = object.path ?? ""; message.height = object.height ?? 0n; message.prove = object.prove ?? false; return message; }, }; function createBaseRequestCheckTx(): RequestCheckTx { return { tx: new Uint8Array(0), type: 0 }; } export const RequestCheckTx: MessageFns<RequestCheckTx> = { encode(message: RequestCheckTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.tx.length !== 0) { writer.uint32(10).bytes(message.tx); } if (message.type !== 0) { writer.uint32(16).int32(message.type); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): RequestCheckTx { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseRequestCheckTx(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.tx = reader.bytes(); continue; } case 2: { if (tag !== 16) { break; } message.type = reader.int32() as any; continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object: any): RequestCheckTx { return { tx: isSet(object.tx) ? bytesFromBase64(object.tx) : new Uint8Array(0), type: isSet(object.type) ? checkTxTypeFromJSON(object.type) : 0, }; }, toJSON(message: RequestCheckTx): unknown { const obj: any = {}; if (message.tx.length !== 0) { obj.tx = base64FromBytes(message.tx); } if (message.type !== 0) { obj.type = checkTxTypeToJSON(message.type); } return obj; }, create<I extends Exact<DeepPartial<RequestCheckTx>, I>>(base?: I): RequestCheckTx { return RequestCheckTx.fromPartial(base ?? ({} as any)); }, fromPartial<I extends Exact<DeepPartial<RequestCheckTx>, I>>(object: I): RequestCheckTx