interchainjs
Version:
InterchainJS is a JavaScript library for interacting with Cosmos SDK based blockchains.
1,181 lines (1,180 loc) • 227 kB
JavaScript
import { Timestamp } from "../../google/protobuf/timestamp";
import { ConsensusParams } from "../types/params";
import { ProofOps } from "../crypto/proof";
import { PublicKey } from "../crypto/keys";
import { BinaryReader, BinaryWriter } from "../../binary";
import { GlobalDecoderRegistry } from "../../registry";
import { toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes, isSet } from "../../helpers";
export var CheckTxType;
(function (CheckTxType) {
CheckTxType[CheckTxType["NEW"] = 0] = "NEW";
CheckTxType[CheckTxType["RECHECK"] = 1] = "RECHECK";
CheckTxType[CheckTxType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(CheckTxType || (CheckTxType = {}));
export const CheckTxTypeAmino = CheckTxType;
export function checkTxTypeFromJSON(object) {
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) {
switch (object) {
case CheckTxType.NEW:
return "NEW";
case CheckTxType.RECHECK:
return "RECHECK";
case CheckTxType.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
}
}
export var ResponseOfferSnapshot_Result;
(function (ResponseOfferSnapshot_Result) {
/** UNKNOWN - Unknown result, abort all snapshot restoration */
ResponseOfferSnapshot_Result[ResponseOfferSnapshot_Result["UNKNOWN"] = 0] = "UNKNOWN";
/** ACCEPT - Snapshot accepted, apply chunks */
ResponseOfferSnapshot_Result[ResponseOfferSnapshot_Result["ACCEPT"] = 1] = "ACCEPT";
/** ABORT - Abort all snapshot restoration */
ResponseOfferSnapshot_Result[ResponseOfferSnapshot_Result["ABORT"] = 2] = "ABORT";
/** REJECT - Reject this specific snapshot, try others */
ResponseOfferSnapshot_Result[ResponseOfferSnapshot_Result["REJECT"] = 3] = "REJECT";
/** REJECT_FORMAT - Reject all snapshots of this format, try others */
ResponseOfferSnapshot_Result[ResponseOfferSnapshot_Result["REJECT_FORMAT"] = 4] = "REJECT_FORMAT";
/** REJECT_SENDER - Reject all snapshots from the sender(s), try others */
ResponseOfferSnapshot_Result[ResponseOfferSnapshot_Result["REJECT_SENDER"] = 5] = "REJECT_SENDER";
ResponseOfferSnapshot_Result[ResponseOfferSnapshot_Result["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(ResponseOfferSnapshot_Result || (ResponseOfferSnapshot_Result = {}));
export const ResponseOfferSnapshot_ResultAmino = ResponseOfferSnapshot_Result;
export function responseOfferSnapshot_ResultFromJSON(object) {
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) {
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 var ResponseApplySnapshotChunk_Result;
(function (ResponseApplySnapshotChunk_Result) {
/** UNKNOWN - Unknown result, abort all snapshot restoration */
ResponseApplySnapshotChunk_Result[ResponseApplySnapshotChunk_Result["UNKNOWN"] = 0] = "UNKNOWN";
/** ACCEPT - Chunk successfully accepted */
ResponseApplySnapshotChunk_Result[ResponseApplySnapshotChunk_Result["ACCEPT"] = 1] = "ACCEPT";
/** ABORT - Abort all snapshot restoration */
ResponseApplySnapshotChunk_Result[ResponseApplySnapshotChunk_Result["ABORT"] = 2] = "ABORT";
/** RETRY - Retry chunk (combine with refetch and reject) */
ResponseApplySnapshotChunk_Result[ResponseApplySnapshotChunk_Result["RETRY"] = 3] = "RETRY";
/** RETRY_SNAPSHOT - Retry snapshot (combine with refetch and reject) */
ResponseApplySnapshotChunk_Result[ResponseApplySnapshotChunk_Result["RETRY_SNAPSHOT"] = 4] = "RETRY_SNAPSHOT";
/** REJECT_SNAPSHOT - Reject this snapshot, try others */
ResponseApplySnapshotChunk_Result[ResponseApplySnapshotChunk_Result["REJECT_SNAPSHOT"] = 5] = "REJECT_SNAPSHOT";
ResponseApplySnapshotChunk_Result[ResponseApplySnapshotChunk_Result["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(ResponseApplySnapshotChunk_Result || (ResponseApplySnapshotChunk_Result = {}));
export const ResponseApplySnapshotChunk_ResultAmino = ResponseApplySnapshotChunk_Result;
export function responseApplySnapshotChunk_ResultFromJSON(object) {
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) {
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 var ResponseProcessProposal_ProposalStatus;
(function (ResponseProcessProposal_ProposalStatus) {
ResponseProcessProposal_ProposalStatus[ResponseProcessProposal_ProposalStatus["UNKNOWN"] = 0] = "UNKNOWN";
ResponseProcessProposal_ProposalStatus[ResponseProcessProposal_ProposalStatus["ACCEPT"] = 1] = "ACCEPT";
ResponseProcessProposal_ProposalStatus[ResponseProcessProposal_ProposalStatus["REJECT"] = 2] = "REJECT";
ResponseProcessProposal_ProposalStatus[ResponseProcessProposal_ProposalStatus["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(ResponseProcessProposal_ProposalStatus || (ResponseProcessProposal_ProposalStatus = {}));
export const ResponseProcessProposal_ProposalStatusAmino = ResponseProcessProposal_ProposalStatus;
export function responseProcessProposal_ProposalStatusFromJSON(object) {
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) {
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 var ResponseVerifyVoteExtension_VerifyStatus;
(function (ResponseVerifyVoteExtension_VerifyStatus) {
ResponseVerifyVoteExtension_VerifyStatus[ResponseVerifyVoteExtension_VerifyStatus["UNKNOWN"] = 0] = "UNKNOWN";
ResponseVerifyVoteExtension_VerifyStatus[ResponseVerifyVoteExtension_VerifyStatus["ACCEPT"] = 1] = "ACCEPT";
/**
* 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.
*/
ResponseVerifyVoteExtension_VerifyStatus[ResponseVerifyVoteExtension_VerifyStatus["REJECT"] = 2] = "REJECT";
ResponseVerifyVoteExtension_VerifyStatus[ResponseVerifyVoteExtension_VerifyStatus["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(ResponseVerifyVoteExtension_VerifyStatus || (ResponseVerifyVoteExtension_VerifyStatus = {}));
export const ResponseVerifyVoteExtension_VerifyStatusAmino = ResponseVerifyVoteExtension_VerifyStatus;
export function responseVerifyVoteExtension_VerifyStatusFromJSON(object) {
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) {
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 var MisbehaviorType;
(function (MisbehaviorType) {
MisbehaviorType[MisbehaviorType["UNKNOWN"] = 0] = "UNKNOWN";
MisbehaviorType[MisbehaviorType["DUPLICATE_VOTE"] = 1] = "DUPLICATE_VOTE";
MisbehaviorType[MisbehaviorType["LIGHT_CLIENT_ATTACK"] = 2] = "LIGHT_CLIENT_ATTACK";
MisbehaviorType[MisbehaviorType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(MisbehaviorType || (MisbehaviorType = {}));
export const MisbehaviorTypeAmino = MisbehaviorType;
export function misbehaviorTypeFromJSON(object) {
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) {
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";
}
}
function createBaseRequest() {
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
};
}
/**
* @name Request
* @package tendermint.abci
* @see proto type: tendermint.abci.Request
*/
export const Request = {
typeUrl: "/tendermint.abci.Request",
is(o) {
return o && o.$typeUrl === Request.typeUrl;
},
isAmino(o) {
return o && o.$typeUrl === Request.typeUrl;
},
encode(message, writer = BinaryWriter.create()) {
if (message.echo !== undefined) {
RequestEcho.encode(message.echo, writer.uint32(10).fork()).ldelim();
}
if (message.flush !== undefined) {
RequestFlush.encode(message.flush, writer.uint32(18).fork()).ldelim();
}
if (message.info !== undefined) {
RequestInfo.encode(message.info, writer.uint32(26).fork()).ldelim();
}
if (message.initChain !== undefined) {
RequestInitChain.encode(message.initChain, writer.uint32(42).fork()).ldelim();
}
if (message.query !== undefined) {
RequestQuery.encode(message.query, writer.uint32(50).fork()).ldelim();
}
if (message.checkTx !== undefined) {
RequestCheckTx.encode(message.checkTx, writer.uint32(66).fork()).ldelim();
}
if (message.commit !== undefined) {
RequestCommit.encode(message.commit, writer.uint32(90).fork()).ldelim();
}
if (message.listSnapshots !== undefined) {
RequestListSnapshots.encode(message.listSnapshots, writer.uint32(98).fork()).ldelim();
}
if (message.offerSnapshot !== undefined) {
RequestOfferSnapshot.encode(message.offerSnapshot, writer.uint32(106).fork()).ldelim();
}
if (message.loadSnapshotChunk !== undefined) {
RequestLoadSnapshotChunk.encode(message.loadSnapshotChunk, writer.uint32(114).fork()).ldelim();
}
if (message.applySnapshotChunk !== undefined) {
RequestApplySnapshotChunk.encode(message.applySnapshotChunk, writer.uint32(122).fork()).ldelim();
}
if (message.prepareProposal !== undefined) {
RequestPrepareProposal.encode(message.prepareProposal, writer.uint32(130).fork()).ldelim();
}
if (message.processProposal !== undefined) {
RequestProcessProposal.encode(message.processProposal, writer.uint32(138).fork()).ldelim();
}
if (message.extendVote !== undefined) {
RequestExtendVote.encode(message.extendVote, writer.uint32(146).fork()).ldelim();
}
if (message.verifyVoteExtension !== undefined) {
RequestVerifyVoteExtension.encode(message.verifyVoteExtension, writer.uint32(154).fork()).ldelim();
}
if (message.finalizeBlock !== undefined) {
RequestFinalizeBlock.encode(message.finalizeBlock, writer.uint32(162).fork()).ldelim();
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.echo = RequestEcho.decode(reader, reader.uint32());
break;
case 2:
message.flush = RequestFlush.decode(reader, reader.uint32());
break;
case 3:
message.info = RequestInfo.decode(reader, reader.uint32());
break;
case 5:
message.initChain = RequestInitChain.decode(reader, reader.uint32());
break;
case 6:
message.query = RequestQuery.decode(reader, reader.uint32());
break;
case 8:
message.checkTx = RequestCheckTx.decode(reader, reader.uint32());
break;
case 11:
message.commit = RequestCommit.decode(reader, reader.uint32());
break;
case 12:
message.listSnapshots = RequestListSnapshots.decode(reader, reader.uint32());
break;
case 13:
message.offerSnapshot = RequestOfferSnapshot.decode(reader, reader.uint32());
break;
case 14:
message.loadSnapshotChunk = RequestLoadSnapshotChunk.decode(reader, reader.uint32());
break;
case 15:
message.applySnapshotChunk = RequestApplySnapshotChunk.decode(reader, reader.uint32());
break;
case 16:
message.prepareProposal = RequestPrepareProposal.decode(reader, reader.uint32());
break;
case 17:
message.processProposal = RequestProcessProposal.decode(reader, reader.uint32());
break;
case 18:
message.extendVote = RequestExtendVote.decode(reader, reader.uint32());
break;
case 19:
message.verifyVoteExtension = RequestVerifyVoteExtension.decode(reader, reader.uint32());
break;
case 20:
message.finalizeBlock = RequestFinalizeBlock.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromPartial(object) {
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;
},
fromAmino(object) {
const message = createBaseRequest();
if (object.echo !== undefined && object.echo !== null) {
message.echo = RequestEcho.fromAmino(object.echo);
}
if (object.flush !== undefined && object.flush !== null) {
message.flush = RequestFlush.fromAmino(object.flush);
}
if (object.info !== undefined && object.info !== null) {
message.info = RequestInfo.fromAmino(object.info);
}
if (object.init_chain !== undefined && object.init_chain !== null) {
message.initChain = RequestInitChain.fromAmino(object.init_chain);
}
if (object.query !== undefined && object.query !== null) {
message.query = RequestQuery.fromAmino(object.query);
}
if (object.check_tx !== undefined && object.check_tx !== null) {
message.checkTx = RequestCheckTx.fromAmino(object.check_tx);
}
if (object.commit !== undefined && object.commit !== null) {
message.commit = RequestCommit.fromAmino(object.commit);
}
if (object.list_snapshots !== undefined && object.list_snapshots !== null) {
message.listSnapshots = RequestListSnapshots.fromAmino(object.list_snapshots);
}
if (object.offer_snapshot !== undefined && object.offer_snapshot !== null) {
message.offerSnapshot = RequestOfferSnapshot.fromAmino(object.offer_snapshot);
}
if (object.load_snapshot_chunk !== undefined && object.load_snapshot_chunk !== null) {
message.loadSnapshotChunk = RequestLoadSnapshotChunk.fromAmino(object.load_snapshot_chunk);
}
if (object.apply_snapshot_chunk !== undefined && object.apply_snapshot_chunk !== null) {
message.applySnapshotChunk = RequestApplySnapshotChunk.fromAmino(object.apply_snapshot_chunk);
}
if (object.prepare_proposal !== undefined && object.prepare_proposal !== null) {
message.prepareProposal = RequestPrepareProposal.fromAmino(object.prepare_proposal);
}
if (object.process_proposal !== undefined && object.process_proposal !== null) {
message.processProposal = RequestProcessProposal.fromAmino(object.process_proposal);
}
if (object.extend_vote !== undefined && object.extend_vote !== null) {
message.extendVote = RequestExtendVote.fromAmino(object.extend_vote);
}
if (object.verify_vote_extension !== undefined && object.verify_vote_extension !== null) {
message.verifyVoteExtension = RequestVerifyVoteExtension.fromAmino(object.verify_vote_extension);
}
if (object.finalize_block !== undefined && object.finalize_block !== null) {
message.finalizeBlock = RequestFinalizeBlock.fromAmino(object.finalize_block);
}
return message;
},
toAmino(message) {
const obj = {};
obj.echo = message.echo ? RequestEcho.toAmino(message.echo) : undefined;
obj.flush = message.flush ? RequestFlush.toAmino(message.flush) : undefined;
obj.info = message.info ? RequestInfo.toAmino(message.info) : undefined;
obj.init_chain = message.initChain ? RequestInitChain.toAmino(message.initChain) : undefined;
obj.query = message.query ? RequestQuery.toAmino(message.query) : undefined;
obj.check_tx = message.checkTx ? RequestCheckTx.toAmino(message.checkTx) : undefined;
obj.commit = message.commit ? RequestCommit.toAmino(message.commit) : undefined;
obj.list_snapshots = message.listSnapshots ? RequestListSnapshots.toAmino(message.listSnapshots) : undefined;
obj.offer_snapshot = message.offerSnapshot ? RequestOfferSnapshot.toAmino(message.offerSnapshot) : undefined;
obj.load_snapshot_chunk = message.loadSnapshotChunk ? RequestLoadSnapshotChunk.toAmino(message.loadSnapshotChunk) : undefined;
obj.apply_snapshot_chunk = message.applySnapshotChunk ? RequestApplySnapshotChunk.toAmino(message.applySnapshotChunk) : undefined;
obj.prepare_proposal = message.prepareProposal ? RequestPrepareProposal.toAmino(message.prepareProposal) : undefined;
obj.process_proposal = message.processProposal ? RequestProcessProposal.toAmino(message.processProposal) : undefined;
obj.extend_vote = message.extendVote ? RequestExtendVote.toAmino(message.extendVote) : undefined;
obj.verify_vote_extension = message.verifyVoteExtension ? RequestVerifyVoteExtension.toAmino(message.verifyVoteExtension) : undefined;
obj.finalize_block = message.finalizeBlock ? RequestFinalizeBlock.toAmino(message.finalizeBlock) : undefined;
return obj;
},
fromAminoMsg(object) {
return Request.fromAmino(object.value);
},
fromProtoMsg(message) {
return Request.decode(message.value);
},
toProto(message) {
return Request.encode(message).finish();
},
toProtoMsg(message) {
return {
typeUrl: "/tendermint.abci.Request",
value: Request.encode(message).finish()
};
},
registerTypeUrl() {
if (!GlobalDecoderRegistry.registerExistingTypeUrl(Request.typeUrl)) {
return;
}
RequestEcho.registerTypeUrl();
RequestFlush.registerTypeUrl();
RequestInfo.registerTypeUrl();
RequestInitChain.registerTypeUrl();
RequestQuery.registerTypeUrl();
RequestCheckTx.registerTypeUrl();
RequestCommit.registerTypeUrl();
RequestListSnapshots.registerTypeUrl();
RequestOfferSnapshot.registerTypeUrl();
RequestLoadSnapshotChunk.registerTypeUrl();
RequestApplySnapshotChunk.registerTypeUrl();
RequestPrepareProposal.registerTypeUrl();
RequestProcessProposal.registerTypeUrl();
RequestExtendVote.registerTypeUrl();
RequestVerifyVoteExtension.registerTypeUrl();
RequestFinalizeBlock.registerTypeUrl();
}
};
function createBaseRequestEcho() {
return {
message: ""
};
}
/**
* @name RequestEcho
* @package tendermint.abci
* @see proto type: tendermint.abci.RequestEcho
*/
export const RequestEcho = {
typeUrl: "/tendermint.abci.RequestEcho",
is(o) {
return o && (o.$typeUrl === RequestEcho.typeUrl || typeof o.message === "string");
},
isAmino(o) {
return o && (o.$typeUrl === RequestEcho.typeUrl || typeof o.message === "string");
},
encode(message, writer = BinaryWriter.create()) {
if (message.message !== "") {
writer.uint32(10).string(message.message);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseRequestEcho();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.message = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromPartial(object) {
const message = createBaseRequestEcho();
message.message = object.message ?? "";
return message;
},
fromAmino(object) {
const message = createBaseRequestEcho();
if (object.message !== undefined && object.message !== null) {
message.message = object.message;
}
return message;
},
toAmino(message) {
const obj = {};
obj.message = message.message === "" ? undefined : message.message;
return obj;
},
fromAminoMsg(object) {
return RequestEcho.fromAmino(object.value);
},
fromProtoMsg(message) {
return RequestEcho.decode(message.value);
},
toProto(message) {
return RequestEcho.encode(message).finish();
},
toProtoMsg(message) {
return {
typeUrl: "/tendermint.abci.RequestEcho",
value: RequestEcho.encode(message).finish()
};
},
registerTypeUrl() { }
};
function createBaseRequestFlush() {
return {};
}
/**
* @name RequestFlush
* @package tendermint.abci
* @see proto type: tendermint.abci.RequestFlush
*/
export const RequestFlush = {
typeUrl: "/tendermint.abci.RequestFlush",
is(o) {
return o && o.$typeUrl === RequestFlush.typeUrl;
},
isAmino(o) {
return o && o.$typeUrl === RequestFlush.typeUrl;
},
encode(_, writer = BinaryWriter.create()) {
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseRequestFlush();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromPartial(_) {
const message = createBaseRequestFlush();
return message;
},
fromAmino(_) {
const message = createBaseRequestFlush();
return message;
},
toAmino(_) {
const obj = {};
return obj;
},
fromAminoMsg(object) {
return RequestFlush.fromAmino(object.value);
},
fromProtoMsg(message) {
return RequestFlush.decode(message.value);
},
toProto(message) {
return RequestFlush.encode(message).finish();
},
toProtoMsg(message) {
return {
typeUrl: "/tendermint.abci.RequestFlush",
value: RequestFlush.encode(message).finish()
};
},
registerTypeUrl() { }
};
function createBaseRequestInfo() {
return {
version: "",
blockVersion: BigInt(0),
p2pVersion: BigInt(0),
abciVersion: ""
};
}
/**
* @name RequestInfo
* @package tendermint.abci
* @see proto type: tendermint.abci.RequestInfo
*/
export const RequestInfo = {
typeUrl: "/tendermint.abci.RequestInfo",
is(o) {
return o && (o.$typeUrl === RequestInfo.typeUrl || typeof o.version === "string" && typeof o.blockVersion === "bigint" && typeof o.p2pVersion === "bigint" && typeof o.abciVersion === "string");
},
isAmino(o) {
return o && (o.$typeUrl === RequestInfo.typeUrl || typeof o.version === "string" && typeof o.block_version === "bigint" && typeof o.p2p_version === "bigint" && typeof o.abci_version === "string");
},
encode(message, writer = BinaryWriter.create()) {
if (message.version !== "") {
writer.uint32(10).string(message.version);
}
if (message.blockVersion !== BigInt(0)) {
writer.uint32(16).uint64(message.blockVersion);
}
if (message.p2pVersion !== BigInt(0)) {
writer.uint32(24).uint64(message.p2pVersion);
}
if (message.abciVersion !== "") {
writer.uint32(34).string(message.abciVersion);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseRequestInfo();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.version = reader.string();
break;
case 2:
message.blockVersion = reader.uint64();
break;
case 3:
message.p2pVersion = reader.uint64();
break;
case 4:
message.abciVersion = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromPartial(object) {
const message = createBaseRequestInfo();
message.version = object.version ?? "";
message.blockVersion = object.blockVersion !== undefined && object.blockVersion !== null ? BigInt(object.blockVersion.toString()) : BigInt(0);
message.p2pVersion = object.p2pVersion !== undefined && object.p2pVersion !== null ? BigInt(object.p2pVersion.toString()) : BigInt(0);
message.abciVersion = object.abciVersion ?? "";
return message;
},
fromAmino(object) {
const message = createBaseRequestInfo();
if (object.version !== undefined && object.version !== null) {
message.version = object.version;
}
if (object.block_version !== undefined && object.block_version !== null) {
message.blockVersion = BigInt(object.block_version);
}
if (object.p2p_version !== undefined && object.p2p_version !== null) {
message.p2pVersion = BigInt(object.p2p_version);
}
if (object.abci_version !== undefined && object.abci_version !== null) {
message.abciVersion = object.abci_version;
}
return message;
},
toAmino(message) {
const obj = {};
obj.version = message.version === "" ? undefined : message.version;
obj.block_version = message.blockVersion !== BigInt(0) ? message.blockVersion?.toString() : undefined;
obj.p2p_version = message.p2pVersion !== BigInt(0) ? message.p2pVersion?.toString() : undefined;
obj.abci_version = message.abciVersion === "" ? undefined : message.abciVersion;
return obj;
},
fromAminoMsg(object) {
return RequestInfo.fromAmino(object.value);
},
fromProtoMsg(message) {
return RequestInfo.decode(message.value);
},
toProto(message) {
return RequestInfo.encode(message).finish();
},
toProtoMsg(message) {
return {
typeUrl: "/tendermint.abci.RequestInfo",
value: RequestInfo.encode(message).finish()
};
},
registerTypeUrl() { }
};
function createBaseRequestInitChain() {
return {
time: new Date(),
chainId: "",
consensusParams: undefined,
validators: [],
appStateBytes: new Uint8Array(),
initialHeight: BigInt(0)
};
}
/**
* @name RequestInitChain
* @package tendermint.abci
* @see proto type: tendermint.abci.RequestInitChain
*/
export const RequestInitChain = {
typeUrl: "/tendermint.abci.RequestInitChain",
is(o) {
return o && (o.$typeUrl === RequestInitChain.typeUrl || Timestamp.is(o.time) && typeof o.chainId === "string" && Array.isArray(o.validators) && (!o.validators.length || ValidatorUpdate.is(o.validators[0])) && (o.appStateBytes instanceof Uint8Array || typeof o.appStateBytes === "string") && typeof o.initialHeight === "bigint");
},
isAmino(o) {
return o && (o.$typeUrl === RequestInitChain.typeUrl || Timestamp.isAmino(o.time) && typeof o.chain_id === "string" && Array.isArray(o.validators) && (!o.validators.length || ValidatorUpdate.isAmino(o.validators[0])) && (o.app_state_bytes instanceof Uint8Array || typeof o.app_state_bytes === "string") && typeof o.initial_height === "bigint");
},
encode(message, writer = BinaryWriter.create()) {
if (message.time !== undefined) {
Timestamp.encode(toTimestamp(message.time), writer.uint32(10).fork()).ldelim();
}
if (message.chainId !== "") {
writer.uint32(18).string(message.chainId);
}
if (message.consensusParams !== undefined) {
ConsensusParams.encode(message.consensusParams, writer.uint32(26).fork()).ldelim();
}
for (const v of message.validators) {
ValidatorUpdate.encode(v, writer.uint32(34).fork()).ldelim();
}
if (message.appStateBytes.length !== 0) {
writer.uint32(42).bytes(message.appStateBytes);
}
if (message.initialHeight !== BigInt(0)) {
writer.uint32(48).int64(message.initialHeight);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseRequestInitChain();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
break;
case 2:
message.chainId = reader.string();
break;
case 3:
message.consensusParams = ConsensusParams.decode(reader, reader.uint32());
break;
case 4:
message.validators.push(ValidatorUpdate.decode(reader, reader.uint32()));
break;
case 5:
message.appStateBytes = reader.bytes();
break;
case 6:
message.initialHeight = reader.int64();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromPartial(object) {
const message = createBaseRequestInitChain();
message.time = object.time ?? undefined;
message.chainId = object.chainId ?? "";
message.consensusParams = object.consensusParams !== undefined && object.consensusParams !== null ? ConsensusParams.fromPartial(object.consensusParams) : undefined;
message.validators = object.validators?.map(e => ValidatorUpdate.fromPartial(e)) || [];
message.appStateBytes = object.appStateBytes ?? new Uint8Array();
message.initialHeight = object.initialHeight !== undefined && object.initialHeight !== null ? BigInt(object.initialHeight.toString()) : BigInt(0);
return message;
},
fromAmino(object) {
const message = createBaseRequestInitChain();
if (object.time !== undefined && object.time !== null) {
message.time = fromTimestamp(Timestamp.fromAmino(object.time));
}
if (object.chain_id !== undefined && object.chain_id !== null) {
message.chainId = object.chain_id;
}
if (object.consensus_params !== undefined && object.consensus_params !== null) {
message.consensusParams = ConsensusParams.fromAmino(object.consensus_params);
}
message.validators = object.validators?.map(e => ValidatorUpdate.fromAmino(e)) || [];
if (object.app_state_bytes !== undefined && object.app_state_bytes !== null) {
message.appStateBytes = bytesFromBase64(object.app_state_bytes);
}
if (object.initial_height !== undefined && object.initial_height !== null) {
message.initialHeight = BigInt(object.initial_height);
}
return message;
},
toAmino(message) {
const obj = {};
obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined;
obj.chain_id = message.chainId === "" ? undefined : message.chainId;
obj.consensus_params = message.consensusParams ? ConsensusParams.toAmino(message.consensusParams) : undefined;
if (message.validators) {
obj.validators = message.validators.map(e => e ? ValidatorUpdate.toAmino(e) : undefined);
}
else {
obj.validators = message.validators;
}
obj.app_state_bytes = message.appStateBytes ? base64FromBytes(message.appStateBytes) : undefined;
obj.initial_height = message.initialHeight !== BigInt(0) ? message.initialHeight?.toString() : undefined;
return obj;
},
fromAminoMsg(object) {
return RequestInitChain.fromAmino(object.value);
},
fromProtoMsg(message) {
return RequestInitChain.decode(message.value);
},
toProto(message) {
return RequestInitChain.encode(message).finish();
},
toProtoMsg(message) {
return {
typeUrl: "/tendermint.abci.RequestInitChain",
value: RequestInitChain.encode(message).finish()
};
},
registerTypeUrl() {
if (!GlobalDecoderRegistry.registerExistingTypeUrl(RequestInitChain.typeUrl)) {
return;
}
ConsensusParams.registerTypeUrl();
ValidatorUpdate.registerTypeUrl();
}
};
function createBaseRequestQuery() {
return {
data: new Uint8Array(),
path: "",
height: BigInt(0),
prove: false
};
}
/**
* @name RequestQuery
* @package tendermint.abci
* @see proto type: tendermint.abci.RequestQuery
*/
export const RequestQuery = {
typeUrl: "/tendermint.abci.RequestQuery",
is(o) {
return o && (o.$typeUrl === RequestQuery.typeUrl || (o.data instanceof Uint8Array || typeof o.data === "string") && typeof o.path === "string" && typeof o.height === "bigint" && typeof o.prove === "boolean");
},
isAmino(o) {
return o && (o.$typeUrl === RequestQuery.typeUrl || (o.data instanceof Uint8Array || typeof o.data === "string") && typeof o.path === "string" && typeof o.height === "bigint" && typeof o.prove === "boolean");
},
encode(message, writer = BinaryWriter.create()) {
if (message.data.length !== 0) {
writer.uint32(10).bytes(message.data);
}
if (message.path !== "") {
writer.uint32(18).string(message.path);
}
if (message.height !== BigInt(0)) {
writer.uint32(24).int64(message.height);
}
if (message.prove === true) {
writer.uint32(32).bool(message.prove);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseRequestQuery();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.data = reader.bytes();
break;
case 2:
message.path = reader.string();
break;
case 3:
message.height = reader.int64();
break;
case 4:
message.prove = reader.bool();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromPartial(object) {
const message = createBaseRequestQuery();
message.data = object.data ?? new Uint8Array();
message.path = object.path ?? "";
message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0);
message.prove = object.prove ?? false;
return message;
},
fromAmino(object) {
const message = createBaseRequestQuery();
if (object.data !== undefined && object.data !== null) {
message.data = bytesFromBase64(object.data);
}
if (object.path !== undefined && object.path !== null) {
message.path = object.path;
}
if (object.height !== undefined && object.height !== null) {
message.height = BigInt(object.height);
}
if (object.prove !== undefined && object.prove !== null) {
message.prove = object.prove;
}
return message;
},
toAmino(message) {
const obj = {};
obj.data = message.data ? base64FromBytes(message.data) : undefined;
obj.path = message.path === "" ? undefined : message.path;
obj.height = message.height !== BigInt(0) ? message.height?.toString() : undefined;
obj.prove = message.prove === false ? undefined : message.prove;
return obj;
},
fromAminoMsg(object) {
return RequestQuery.fromAmino(object.value);
},
fromProtoMsg(message) {
return RequestQuery.decode(message.value);
},
toProto(message) {
return RequestQuery.encode(message).finish();
},
toProtoMsg(message) {
return {
typeUrl: "/tendermint.abci.RequestQuery",
value: RequestQuery.encode(message).finish()
};
},
registerTypeUrl() { }
};
function createBaseRequestCheckTx() {
return {
tx: new Uint8Array(),
type: 0
};
}
/**
* @name RequestCheckTx
* @package tendermint.abci
* @see proto type: tendermint.abci.RequestCheckTx
*/
export const RequestCheckTx = {
typeUrl: "/tendermint.abci.RequestCheckTx",
is(o) {
return o && (o.$typeUrl === RequestCheckTx.typeUrl || (o.tx instanceof Uint8Array || typeof o.tx === "string") && isSet(o.type));
},
isAmino(o) {
return o && (o.$typeUrl === RequestCheckTx.typeUrl || (o.tx instanceof Uint8Array || typeof o.tx === "string") && isSet(o.type));
},
encode(message, writer = BinaryWriter.create()) {
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, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseRequestCheckTx();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.tx = reader.bytes();
break;
case 2:
message.type = reader.int32();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromPartial(object) {
const message = createBaseRequestCheckTx();
message.tx = object.tx ?? new Uint8Array();
message.type = object.type ?? 0;
return message;
},
fromAmino(object) {
const message = createBaseRequestCheckTx();
if (object.tx !== undefined && object.tx !== null) {
message.tx = bytesFromBase64(object.tx);
}
if (object.type !== undefined && object.type !== null) {
message.type = object.type;
}
return message;
},
toAmino(message) {
const obj = {};
obj.tx = message.tx ? base64FromBytes(message.tx) : undefined;
obj.type = message.type === 0 ? undefined : message.type;
return obj;
},
fromAminoMsg(object) {
return RequestCheckTx.fromAmino(object.value);
},
fromProtoMsg(message) {
return RequestCheckTx.decode(message.value);
},
toProto(message) {
return RequestCheckTx.encode(message).finish();
},
toProtoMsg(message) {
return {
typeUrl: "/tendermint.abci.RequestCheckTx",
value: RequestCheckTx.encode(message).finish()
};
},
registerTypeUrl() { }
};
function createBaseRequestCommit() {
return {};
}
/**
* @name RequestCommit
* @package tendermint.abci
* @see proto type: tendermint.abci.RequestCommit
*/
export const RequestCommit = {
typeUrl: "/tendermint.abci.RequestCommit",
is(o) {
return o && o.$typeUrl === RequestCommit.typeUrl;
},
isAmino(o) {
return o && o.$typeUrl === RequestCommit.typeUrl;
},
encode(_, writer = BinaryWriter.create()) {
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseRequestCommit();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
default:
reader.skipType(tag & 7);
break;
}
}
return message;