import { EpochInfo } from "./genesis"; import * as _m0 from "protobufjs/minimal"; import { DeepPartial, isSet, Long } from "@osmonauts/helpers"; export interface QueryEpochsInfoRequest {} export interface QueryEpochsInfoResponse { epochs: EpochInfo[]; } export interface QueryCurrentEpochRequest { identifier: string; } export interface QueryCurrentEpochResponse { current_epoch: Long; } function createBaseQueryEpochsInfoRequest(): QueryEpochsInfoRequest { return {}; } export const QueryEpochsInfoRequest = { encode(_: QueryEpochsInfoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryEpochsInfoRequest { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryEpochsInfoRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } return message; }, fromJSON(_: any): QueryEpochsInfoRequest { return {}; }, toJSON(_: QueryEpochsInfoRequest): unknown { const obj: any = {}; return obj; }, fromPartial(_: DeepPartial): QueryEpochsInfoRequest { const message = createBaseQueryEpochsInfoRequest(); return message; } }; function createBaseQueryEpochsInfoResponse(): QueryEpochsInfoResponse { return { epochs: [] }; } export const QueryEpochsInfoResponse = { encode(message: QueryEpochsInfoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { for (const v of message.epochs) { EpochInfo.encode(v!, writer.uint32(10).fork()).ldelim(); } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryEpochsInfoResponse { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryEpochsInfoResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: message.epochs.push(EpochInfo.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); break; } } return message; }, fromJSON(object: any): QueryEpochsInfoResponse { return { epochs: Array.isArray(object?.epochs) ? object.epochs.map((e: any) => EpochInfo.fromJSON(e)) : [] }; }, toJSON(message: QueryEpochsInfoResponse): unknown { const obj: any = {}; if (message.epochs) { obj.epochs = message.epochs.map(e => e ? EpochInfo.toJSON(e) : undefined); } else { obj.epochs = []; } return obj; }, fromPartial(object: DeepPartial): QueryEpochsInfoResponse { const message = createBaseQueryEpochsInfoResponse(); message.epochs = object.epochs?.map(e => EpochInfo.fromPartial(e)) || []; return message; } }; function createBaseQueryCurrentEpochRequest(): QueryCurrentEpochRequest { return { identifier: "" }; } export const QueryCurrentEpochRequest = { encode(message: QueryCurrentEpochRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { if (message.identifier !== "") { writer.uint32(10).string(message.identifier); } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryCurrentEpochRequest { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryCurrentEpochRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: message.identifier = reader.string(); break; default: reader.skipType(tag & 7); break; } } return message; }, fromJSON(object: any): QueryCurrentEpochRequest { return { identifier: isSet(object.identifier) ? String(object.identifier) : "" }; }, toJSON(message: QueryCurrentEpochRequest): unknown { const obj: any = {}; message.identifier !== undefined && (obj.identifier = message.identifier); return obj; }, fromPartial(object: DeepPartial): QueryCurrentEpochRequest { const message = createBaseQueryCurrentEpochRequest(); message.identifier = object.identifier ?? ""; return message; } }; function createBaseQueryCurrentEpochResponse(): QueryCurrentEpochResponse { return { current_epoch: Long.ZERO }; } export const QueryCurrentEpochResponse = { encode(message: QueryCurrentEpochResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { if (!message.current_epoch.isZero()) { writer.uint32(8).int64(message.current_epoch); } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryCurrentEpochResponse { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryCurrentEpochResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: message.current_epoch = (reader.int64() as Long); break; default: reader.skipType(tag & 7); break; } } return message; }, fromJSON(object: any): QueryCurrentEpochResponse { return { current_epoch: isSet(object.current_epoch) ? Long.fromString(object.current_epoch) : Long.ZERO }; }, toJSON(message: QueryCurrentEpochResponse): unknown { const obj: any = {}; message.current_epoch !== undefined && (obj.current_epoch = (message.current_epoch || Long.ZERO).toString()); return obj; }, fromPartial(object: DeepPartial): QueryCurrentEpochResponse { const message = createBaseQueryCurrentEpochResponse(); message.current_epoch = object.current_epoch !== undefined && object.current_epoch !== null ? Long.fromValue(object.current_epoch) : Long.ZERO; return message; } };