UNPKG

@bandprotocol/bandchain.js

Version:

TypeScript library for Cosmos SDK and BandChain

1,148 lines (1,147 loc) 169 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.EventAttribute = exports.Event = exports.LastCommitInfo = exports.BlockParams = exports.ConsensusParams = exports.ResponseApplySnapshotChunk = exports.ResponseLoadSnapshotChunk = exports.ResponseOfferSnapshot = exports.ResponseListSnapshots = exports.ResponseCommit = exports.ResponseEndBlock = exports.ResponseDeliverTx = exports.ResponseCheckTx = exports.ResponseBeginBlock = exports.ResponseQuery = exports.ResponseInitChain = exports.ResponseSetOption = exports.ResponseInfo = exports.ResponseFlush = exports.ResponseEcho = exports.ResponseException = exports.Response = exports.RequestApplySnapshotChunk = exports.RequestLoadSnapshotChunk = exports.RequestOfferSnapshot = exports.RequestListSnapshots = exports.RequestCommit = exports.RequestEndBlock = exports.RequestDeliverTx = exports.RequestCheckTx = exports.RequestBeginBlock = exports.RequestQuery = exports.RequestInitChain = exports.RequestSetOption = exports.RequestInfo = exports.RequestFlush = exports.RequestEcho = exports.Request = exports.EvidenceTypeAmino = exports.EvidenceTypeSDKType = exports.EvidenceType = exports.ResponseApplySnapshotChunk_ResultAmino = exports.ResponseApplySnapshotChunk_ResultSDKType = exports.ResponseApplySnapshotChunk_Result = exports.ResponseOfferSnapshot_ResultAmino = exports.ResponseOfferSnapshot_ResultSDKType = exports.ResponseOfferSnapshot_Result = exports.CheckTxTypeAmino = exports.CheckTxTypeSDKType = exports.CheckTxType = void 0; exports.Snapshot = exports.Evidence = exports.VoteInfo = exports.ValidatorUpdate = exports.Validator = exports.TxResult = void 0; exports.checkTxTypeFromJSON = checkTxTypeFromJSON; exports.checkTxTypeToJSON = checkTxTypeToJSON; exports.responseOfferSnapshot_ResultFromJSON = responseOfferSnapshot_ResultFromJSON; exports.responseOfferSnapshot_ResultToJSON = responseOfferSnapshot_ResultToJSON; exports.responseApplySnapshotChunk_ResultFromJSON = responseApplySnapshotChunk_ResultFromJSON; exports.responseApplySnapshotChunk_ResultToJSON = responseApplySnapshotChunk_ResultToJSON; exports.evidenceTypeFromJSON = evidenceTypeFromJSON; exports.evidenceTypeToJSON = evidenceTypeToJSON; //@ts-nocheck const timestamp_1 = require("../../google/protobuf/timestamp"); const types_1 = require("../types/types"); const proof_1 = require("../crypto/proof"); const params_1 = require("../types/params"); const keys_1 = require("../crypto/keys"); const binary_1 = require("../../binary"); const helpers_1 = require("../../helpers"); var CheckTxType; (function (CheckTxType) { CheckTxType[CheckTxType["NEW"] = 0] = "NEW"; CheckTxType[CheckTxType["RECHECK"] = 1] = "RECHECK"; CheckTxType[CheckTxType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; })(CheckTxType || (exports.CheckTxType = CheckTxType = {})); exports.CheckTxTypeSDKType = CheckTxType; exports.CheckTxTypeAmino = CheckTxType; 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; } } function checkTxTypeToJSON(object) { switch (object) { case CheckTxType.NEW: return "NEW"; case CheckTxType.RECHECK: return "RECHECK"; case CheckTxType.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } 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 || (exports.ResponseOfferSnapshot_Result = ResponseOfferSnapshot_Result = {})); exports.ResponseOfferSnapshot_ResultSDKType = ResponseOfferSnapshot_Result; exports.ResponseOfferSnapshot_ResultAmino = ResponseOfferSnapshot_Result; 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; } } 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"; } } 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 || (exports.ResponseApplySnapshotChunk_Result = ResponseApplySnapshotChunk_Result = {})); exports.ResponseApplySnapshotChunk_ResultSDKType = ResponseApplySnapshotChunk_Result; exports.ResponseApplySnapshotChunk_ResultAmino = ResponseApplySnapshotChunk_Result; 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; } } 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"; } } var EvidenceType; (function (EvidenceType) { EvidenceType[EvidenceType["UNKNOWN"] = 0] = "UNKNOWN"; EvidenceType[EvidenceType["DUPLICATE_VOTE"] = 1] = "DUPLICATE_VOTE"; EvidenceType[EvidenceType["LIGHT_CLIENT_ATTACK"] = 2] = "LIGHT_CLIENT_ATTACK"; EvidenceType[EvidenceType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; })(EvidenceType || (exports.EvidenceType = EvidenceType = {})); exports.EvidenceTypeSDKType = EvidenceType; exports.EvidenceTypeAmino = EvidenceType; function evidenceTypeFromJSON(object) { switch (object) { case 0: case "UNKNOWN": return EvidenceType.UNKNOWN; case 1: case "DUPLICATE_VOTE": return EvidenceType.DUPLICATE_VOTE; case 2: case "LIGHT_CLIENT_ATTACK": return EvidenceType.LIGHT_CLIENT_ATTACK; case -1: case "UNRECOGNIZED": default: return EvidenceType.UNRECOGNIZED; } } function evidenceTypeToJSON(object) { switch (object) { case EvidenceType.UNKNOWN: return "UNKNOWN"; case EvidenceType.DUPLICATE_VOTE: return "DUPLICATE_VOTE"; case EvidenceType.LIGHT_CLIENT_ATTACK: return "LIGHT_CLIENT_ATTACK"; case EvidenceType.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } function createBaseRequest() { return { echo: undefined, flush: undefined, info: undefined, setOption: undefined, initChain: undefined, query: undefined, beginBlock: undefined, checkTx: undefined, deliverTx: undefined, endBlock: undefined, commit: undefined, listSnapshots: undefined, offerSnapshot: undefined, loadSnapshotChunk: undefined, applySnapshotChunk: undefined }; } exports.Request = { typeUrl: "/tendermint.abci.Request", encode(message, writer = binary_1.BinaryWriter.create()) { if (message.echo !== undefined) { exports.RequestEcho.encode(message.echo, writer.uint32(10).fork()).ldelim(); } if (message.flush !== undefined) { exports.RequestFlush.encode(message.flush, writer.uint32(18).fork()).ldelim(); } if (message.info !== undefined) { exports.RequestInfo.encode(message.info, writer.uint32(26).fork()).ldelim(); } if (message.setOption !== undefined) { exports.RequestSetOption.encode(message.setOption, writer.uint32(34).fork()).ldelim(); } if (message.initChain !== undefined) { exports.RequestInitChain.encode(message.initChain, writer.uint32(42).fork()).ldelim(); } if (message.query !== undefined) { exports.RequestQuery.encode(message.query, writer.uint32(50).fork()).ldelim(); } if (message.beginBlock !== undefined) { exports.RequestBeginBlock.encode(message.beginBlock, writer.uint32(58).fork()).ldelim(); } if (message.checkTx !== undefined) { exports.RequestCheckTx.encode(message.checkTx, writer.uint32(66).fork()).ldelim(); } if (message.deliverTx !== undefined) { exports.RequestDeliverTx.encode(message.deliverTx, writer.uint32(74).fork()).ldelim(); } if (message.endBlock !== undefined) { exports.RequestEndBlock.encode(message.endBlock, writer.uint32(82).fork()).ldelim(); } if (message.commit !== undefined) { exports.RequestCommit.encode(message.commit, writer.uint32(90).fork()).ldelim(); } if (message.listSnapshots !== undefined) { exports.RequestListSnapshots.encode(message.listSnapshots, writer.uint32(98).fork()).ldelim(); } if (message.offerSnapshot !== undefined) { exports.RequestOfferSnapshot.encode(message.offerSnapshot, writer.uint32(106).fork()).ldelim(); } if (message.loadSnapshotChunk !== undefined) { exports.RequestLoadSnapshotChunk.encode(message.loadSnapshotChunk, writer.uint32(114).fork()).ldelim(); } if (message.applySnapshotChunk !== undefined) { exports.RequestApplySnapshotChunk.encode(message.applySnapshotChunk, writer.uint32(122).fork()).ldelim(); } return writer; }, decode(input, length) { const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.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 = exports.RequestEcho.decode(reader, reader.uint32()); break; case 2: message.flush = exports.RequestFlush.decode(reader, reader.uint32()); break; case 3: message.info = exports.RequestInfo.decode(reader, reader.uint32()); break; case 4: message.setOption = exports.RequestSetOption.decode(reader, reader.uint32()); break; case 5: message.initChain = exports.RequestInitChain.decode(reader, reader.uint32()); break; case 6: message.query = exports.RequestQuery.decode(reader, reader.uint32()); break; case 7: message.beginBlock = exports.RequestBeginBlock.decode(reader, reader.uint32()); break; case 8: message.checkTx = exports.RequestCheckTx.decode(reader, reader.uint32()); break; case 9: message.deliverTx = exports.RequestDeliverTx.decode(reader, reader.uint32()); break; case 10: message.endBlock = exports.RequestEndBlock.decode(reader, reader.uint32()); break; case 11: message.commit = exports.RequestCommit.decode(reader, reader.uint32()); break; case 12: message.listSnapshots = exports.RequestListSnapshots.decode(reader, reader.uint32()); break; case 13: message.offerSnapshot = exports.RequestOfferSnapshot.decode(reader, reader.uint32()); break; case 14: message.loadSnapshotChunk = exports.RequestLoadSnapshotChunk.decode(reader, reader.uint32()); break; case 15: message.applySnapshotChunk = exports.RequestApplySnapshotChunk.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 ? exports.RequestEcho.fromPartial(object.echo) : undefined; message.flush = object.flush !== undefined && object.flush !== null ? exports.RequestFlush.fromPartial(object.flush) : undefined; message.info = object.info !== undefined && object.info !== null ? exports.RequestInfo.fromPartial(object.info) : undefined; message.setOption = object.setOption !== undefined && object.setOption !== null ? exports.RequestSetOption.fromPartial(object.setOption) : undefined; message.initChain = object.initChain !== undefined && object.initChain !== null ? exports.RequestInitChain.fromPartial(object.initChain) : undefined; message.query = object.query !== undefined && object.query !== null ? exports.RequestQuery.fromPartial(object.query) : undefined; message.beginBlock = object.beginBlock !== undefined && object.beginBlock !== null ? exports.RequestBeginBlock.fromPartial(object.beginBlock) : undefined; message.checkTx = object.checkTx !== undefined && object.checkTx !== null ? exports.RequestCheckTx.fromPartial(object.checkTx) : undefined; message.deliverTx = object.deliverTx !== undefined && object.deliverTx !== null ? exports.RequestDeliverTx.fromPartial(object.deliverTx) : undefined; message.endBlock = object.endBlock !== undefined && object.endBlock !== null ? exports.RequestEndBlock.fromPartial(object.endBlock) : undefined; message.commit = object.commit !== undefined && object.commit !== null ? exports.RequestCommit.fromPartial(object.commit) : undefined; message.listSnapshots = object.listSnapshots !== undefined && object.listSnapshots !== null ? exports.RequestListSnapshots.fromPartial(object.listSnapshots) : undefined; message.offerSnapshot = object.offerSnapshot !== undefined && object.offerSnapshot !== null ? exports.RequestOfferSnapshot.fromPartial(object.offerSnapshot) : undefined; message.loadSnapshotChunk = object.loadSnapshotChunk !== undefined && object.loadSnapshotChunk !== null ? exports.RequestLoadSnapshotChunk.fromPartial(object.loadSnapshotChunk) : undefined; message.applySnapshotChunk = object.applySnapshotChunk !== undefined && object.applySnapshotChunk !== null ? exports.RequestApplySnapshotChunk.fromPartial(object.applySnapshotChunk) : undefined; return message; }, fromAmino(object) { const message = createBaseRequest(); if (object.echo !== undefined && object.echo !== null) { message.echo = exports.RequestEcho.fromAmino(object.echo); } if (object.flush !== undefined && object.flush !== null) { message.flush = exports.RequestFlush.fromAmino(object.flush); } if (object.info !== undefined && object.info !== null) { message.info = exports.RequestInfo.fromAmino(object.info); } if (object.set_option !== undefined && object.set_option !== null) { message.setOption = exports.RequestSetOption.fromAmino(object.set_option); } if (object.init_chain !== undefined && object.init_chain !== null) { message.initChain = exports.RequestInitChain.fromAmino(object.init_chain); } if (object.query !== undefined && object.query !== null) { message.query = exports.RequestQuery.fromAmino(object.query); } if (object.begin_block !== undefined && object.begin_block !== null) { message.beginBlock = exports.RequestBeginBlock.fromAmino(object.begin_block); } if (object.check_tx !== undefined && object.check_tx !== null) { message.checkTx = exports.RequestCheckTx.fromAmino(object.check_tx); } if (object.deliver_tx !== undefined && object.deliver_tx !== null) { message.deliverTx = exports.RequestDeliverTx.fromAmino(object.deliver_tx); } if (object.end_block !== undefined && object.end_block !== null) { message.endBlock = exports.RequestEndBlock.fromAmino(object.end_block); } if (object.commit !== undefined && object.commit !== null) { message.commit = exports.RequestCommit.fromAmino(object.commit); } if (object.list_snapshots !== undefined && object.list_snapshots !== null) { message.listSnapshots = exports.RequestListSnapshots.fromAmino(object.list_snapshots); } if (object.offer_snapshot !== undefined && object.offer_snapshot !== null) { message.offerSnapshot = exports.RequestOfferSnapshot.fromAmino(object.offer_snapshot); } if (object.load_snapshot_chunk !== undefined && object.load_snapshot_chunk !== null) { message.loadSnapshotChunk = exports.RequestLoadSnapshotChunk.fromAmino(object.load_snapshot_chunk); } if (object.apply_snapshot_chunk !== undefined && object.apply_snapshot_chunk !== null) { message.applySnapshotChunk = exports.RequestApplySnapshotChunk.fromAmino(object.apply_snapshot_chunk); } return message; }, toAmino(message) { const obj = {}; obj.echo = message.echo ? exports.RequestEcho.toAmino(message.echo) : undefined; obj.flush = message.flush ? exports.RequestFlush.toAmino(message.flush) : undefined; obj.info = message.info ? exports.RequestInfo.toAmino(message.info) : undefined; obj.set_option = message.setOption ? exports.RequestSetOption.toAmino(message.setOption) : undefined; obj.init_chain = message.initChain ? exports.RequestInitChain.toAmino(message.initChain) : undefined; obj.query = message.query ? exports.RequestQuery.toAmino(message.query) : undefined; obj.begin_block = message.beginBlock ? exports.RequestBeginBlock.toAmino(message.beginBlock) : undefined; obj.check_tx = message.checkTx ? exports.RequestCheckTx.toAmino(message.checkTx) : undefined; obj.deliver_tx = message.deliverTx ? exports.RequestDeliverTx.toAmino(message.deliverTx) : undefined; obj.end_block = message.endBlock ? exports.RequestEndBlock.toAmino(message.endBlock) : undefined; obj.commit = message.commit ? exports.RequestCommit.toAmino(message.commit) : undefined; obj.list_snapshots = message.listSnapshots ? exports.RequestListSnapshots.toAmino(message.listSnapshots) : undefined; obj.offer_snapshot = message.offerSnapshot ? exports.RequestOfferSnapshot.toAmino(message.offerSnapshot) : undefined; obj.load_snapshot_chunk = message.loadSnapshotChunk ? exports.RequestLoadSnapshotChunk.toAmino(message.loadSnapshotChunk) : undefined; obj.apply_snapshot_chunk = message.applySnapshotChunk ? exports.RequestApplySnapshotChunk.toAmino(message.applySnapshotChunk) : undefined; return obj; }, fromAminoMsg(object) { return exports.Request.fromAmino(object.value); }, fromProtoMsg(message) { return exports.Request.decode(message.value); }, toProto(message) { return exports.Request.encode(message).finish(); }, toProtoMsg(message) { return { typeUrl: "/tendermint.abci.Request", value: exports.Request.encode(message).finish() }; } }; function createBaseRequestEcho() { return { message: "" }; } exports.RequestEcho = { typeUrl: "/tendermint.abci.RequestEcho", encode(message, writer = binary_1.BinaryWriter.create()) { if (message.message !== "") { writer.uint32(10).string(message.message); } return writer; }, decode(input, length) { const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.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 exports.RequestEcho.fromAmino(object.value); }, fromProtoMsg(message) { return exports.RequestEcho.decode(message.value); }, toProto(message) { return exports.RequestEcho.encode(message).finish(); }, toProtoMsg(message) { return { typeUrl: "/tendermint.abci.RequestEcho", value: exports.RequestEcho.encode(message).finish() }; } }; function createBaseRequestFlush() { return {}; } exports.RequestFlush = { typeUrl: "/tendermint.abci.RequestFlush", encode(_, writer = binary_1.BinaryWriter.create()) { return writer; }, decode(input, length) { const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.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 exports.RequestFlush.fromAmino(object.value); }, fromProtoMsg(message) { return exports.RequestFlush.decode(message.value); }, toProto(message) { return exports.RequestFlush.encode(message).finish(); }, toProtoMsg(message) { return { typeUrl: "/tendermint.abci.RequestFlush", value: exports.RequestFlush.encode(message).finish() }; } }; function createBaseRequestInfo() { return { version: "", blockVersion: BigInt(0), p2pVersion: BigInt(0) }; } exports.RequestInfo = { typeUrl: "/tendermint.abci.RequestInfo", encode(message, writer = binary_1.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); } return writer; }, decode(input, length) { const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.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; 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); 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); } 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; return obj; }, fromAminoMsg(object) { return exports.RequestInfo.fromAmino(object.value); }, fromProtoMsg(message) { return exports.RequestInfo.decode(message.value); }, toProto(message) { return exports.RequestInfo.encode(message).finish(); }, toProtoMsg(message) { return { typeUrl: "/tendermint.abci.RequestInfo", value: exports.RequestInfo.encode(message).finish() }; } }; function createBaseRequestSetOption() { return { key: "", value: "" }; } exports.RequestSetOption = { typeUrl: "/tendermint.abci.RequestSetOption", encode(message, writer = binary_1.BinaryWriter.create()) { if (message.key !== "") { writer.uint32(10).string(message.key); } if (message.value !== "") { writer.uint32(18).string(message.value); } return writer; }, decode(input, length) { const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseRequestSetOption(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: message.key = reader.string(); break; case 2: message.value = reader.string(); break; default: reader.skipType(tag & 7); break; } } return message; }, fromPartial(object) { const message = createBaseRequestSetOption(); message.key = object.key ?? ""; message.value = object.value ?? ""; return message; }, fromAmino(object) { const message = createBaseRequestSetOption(); if (object.key !== undefined && object.key !== null) { message.key = object.key; } if (object.value !== undefined && object.value !== null) { message.value = object.value; } return message; }, toAmino(message) { const obj = {}; obj.key = message.key === "" ? undefined : message.key; obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object) { return exports.RequestSetOption.fromAmino(object.value); }, fromProtoMsg(message) { return exports.RequestSetOption.decode(message.value); }, toProto(message) { return exports.RequestSetOption.encode(message).finish(); }, toProtoMsg(message) { return { typeUrl: "/tendermint.abci.RequestSetOption", value: exports.RequestSetOption.encode(message).finish() }; } }; function createBaseRequestInitChain() { return { time: new Date(), chainId: "", consensusParams: undefined, validators: [], appStateBytes: new Uint8Array(), initialHeight: BigInt(0) }; } exports.RequestInitChain = { typeUrl: "/tendermint.abci.RequestInitChain", encode(message, writer = binary_1.BinaryWriter.create()) { if (message.time !== undefined) { timestamp_1.Timestamp.encode((0, helpers_1.toTimestamp)(message.time), writer.uint32(10).fork()).ldelim(); } if (message.chainId !== "") { writer.uint32(18).string(message.chainId); } if (message.consensusParams !== undefined) { exports.ConsensusParams.encode(message.consensusParams, writer.uint32(26).fork()).ldelim(); } for (const v of message.validators) { exports.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 binary_1.BinaryReader ? input : new binary_1.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 = (0, helpers_1.fromTimestamp)(timestamp_1.Timestamp.decode(reader, reader.uint32())); break; case 2: message.chainId = reader.string(); break; case 3: message.consensusParams = exports.ConsensusParams.decode(reader, reader.uint32()); break; case 4: message.validators.push(exports.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 ? exports.ConsensusParams.fromPartial(object.consensusParams) : undefined; message.validators = object.validators?.map(e => exports.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 = (0, helpers_1.fromTimestamp)(timestamp_1.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 = exports.ConsensusParams.fromAmino(object.consensus_params); } message.validators = object.validators?.map(e => exports.ValidatorUpdate.fromAmino(e)) || []; if (object.app_state_bytes !== undefined && object.app_state_bytes !== null) { message.appStateBytes = (0, helpers_1.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_1.Timestamp.toAmino((0, helpers_1.toTimestamp)(message.time)) : undefined; obj.chain_id = message.chainId === "" ? undefined : message.chainId; obj.consensus_params = message.consensusParams ? exports.ConsensusParams.toAmino(message.consensusParams) : undefined; if (message.validators) { obj.validators = message.validators.map(e => e ? exports.ValidatorUpdate.toAmino(e) : undefined); } else { obj.validators = message.validators; } obj.app_state_bytes = message.appStateBytes ? (0, helpers_1.base64FromBytes)(message.appStateBytes) : undefined; obj.initial_height = message.initialHeight !== BigInt(0) ? message.initialHeight?.toString() : undefined; return obj; }, fromAminoMsg(object) { return exports.RequestInitChain.fromAmino(object.value); }, fromProtoMsg(message) { return exports.RequestInitChain.decode(message.value); }, toProto(message) { return exports.RequestInitChain.encode(message).finish(); }, toProtoMsg(message) { return { typeUrl: "/tendermint.abci.RequestInitChain", value: exports.RequestInitChain.encode(message).finish() }; } }; function createBaseRequestQuery() { return { data: new Uint8Array(), path: "", height: BigInt(0), prove: false }; } exports.RequestQuery = { typeUrl: "/tendermint.abci.RequestQuery", encode(message, writer = binary_1.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 binary_1.BinaryReader ? input : new binary_1.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 = (0, helpers_1.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 ? (0, helpers_1.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 exports.RequestQuery.fromAmino(object.value); }, fromProtoMsg(message) { return exports.RequestQuery.decode(message.value); }, toProto(message) { return exports.RequestQuery.encode(message).finish(); }, toProtoMsg(message) { return { typeUrl: "/tendermint.abci.RequestQuery", value: exports.RequestQuery.encode(message).finish() }; } }; function createBaseRequestBeginBlock() { return { hash: new Uint8Array(), header: types_1.Header.fromPartial({}), lastCommitInfo: exports.LastCommitInfo.fromPartial({}), byzantineValidators: [] }; } exports.RequestBeginBlock = { typeUrl: "/tendermint.abci.RequestBeginBlock", encode(message, writer = binary_1.BinaryWriter.create()) { if (message.hash.length !== 0) { writer.uint32(10).bytes(message.hash); } if (message.header !== undefined) { types_1.Header.encode(message.header, writer.uint32(18).fork()).ldelim(); } if (message.lastCommitInfo !== undefined) { exports.LastCommitInfo.encode(message.lastCommitInfo, writer.uint32(26).fork()).ldelim(); } for (const v of message.byzantineValidators) { exports.Evidence.encode(v, writer.uint32(34).fork()).ldelim(); } return writer; }, decode(input, length) { const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseRequestBeginBlock(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: message.hash = reader.bytes(); break; case 2: message.header = types_1.Header.decode(reader, reader.uint32()); break; case 3: message.lastCommitInfo = exports.LastCommitInfo.decode(reader, reader.uint32()); break; case 4: message.byzantineValidators.push(exports.Evidence.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); break; } } return message; }, fromPartial(object) { const message = createBaseRequestBeginBlock(); message.hash = object.hash ?? new Uint8Array(); message.header = object.header !== undefined && object.header !== null ? types_1.Header.fromPartial(object.header) : undefined; message.lastCommitInfo = object.lastCommitInfo !== undefined && object.lastCommitInfo !== null ? exports.LastCommitInfo.fromPartial(object.lastCommitInfo) : undefined; message.byzantineValidators = object.byzantineValidators?.map(e => exports.Evidence.fromPartial(e)) || []; return message; }, fromAmino(object) { const message = createBaseRequestBeginBlock(); if (object.hash !== undefined && object.hash !== null) { message.hash = (0, helpers_1.bytesFromBase64)(object.hash); } if (object.header !== undefined && object.header !== null) { message.header = types_1.Header.fromAmino(object.header); } if (object.last_commit_info !== undefined && object.last_commit_info !== null) { message.lastCommitInfo = exports.LastCommitInfo.fromAmino(object.last_commit_info); } message.byzantineValidators = object.byzantine_validators?.map(e => exports.Evidence.fromAmino(e)) || []; return message; }, toAmino(message) { const obj = {}; obj.hash = message.hash ? (0, helpers_1.base64FromBytes)(message.hash) : undefined; obj.header = message.header ? types_1.Header.toAmino(message.header) : undefined; obj.last_commit_info = message.lastCommitInfo ? exports.LastCommitInfo.toAmino(message.lastCommitInfo) : undefined; if (message.byzantineValidators) { obj.byzantine_validators = message.byzantineValidators.map(e => e ? exports.Evidence.toAmino(e) : undefined); } else { obj.byzantine_validators = message.byzantineValidators; } return obj; }, fromAminoMsg(object) { return exports.RequestBeginBlock.fromAmino(object.value); }, fromProtoMsg(message) { return exports.RequestBeginBlock.decode(message.value); }, toProto(message) { return exports.RequestBeginBlock.encode(message).finish(); }, toProtoMsg(message) { return { typeUrl: "/tendermint.abci.RequestBeginBlock", value: exports.RequestBeginBlock.encode(message).finish() }; } }; function createBaseRequestCheckTx() { return { tx: new Uint8Array(), type: 0 }; } exports.RequestCheckTx = { typeUrl: "/tendermint.abci.RequestCheckTx", encode(message, writer = binary_1.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 binary_1.BinaryReader ? input : new binary_1.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 = (0, helpers_1.bytesFromBase64)(object.tx); } if (object.type !== undefined && object.type !== null) { message.type = object.type; } return message; }, toAmino(message) { const obj = {}; obj.tx = message.tx ? (0, helpers_1.base64FromBytes)(message.tx) : undefined; obj.type = message.type === 0 ? undefined : message.type; return obj; }, fromAminoMsg(object) { return exports.RequestCheckTx.fromAmino(object.value); }, fromProtoMsg(message) { return exports.RequestCheckTx.decode(message.value); }, toProto(message) { return exports.RequestCheckTx.encode(message).finish(); }, toProtoMsg(message) { return { typeUrl: "/tendermint.abci.RequestCheckTx", value: exports.RequestCheckTx.encode(message).finish() }; } }; function createBaseRequestDeliverTx() { return { tx: new Uint8Array() }; } exports.RequestDeliverTx = { typeUrl: "/tendermint.abci.RequestDeliverTx", encode(message, writer = binary_1.BinaryWriter.create()) { if (message.tx.length !== 0) { writer.uint32(10).bytes(message.tx); } return writer; }, decode(input, length) { const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseRequestDeliverTx(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: