/* eslint-disable */ import Long from 'long'; import _m0 from 'protobufjs/minimal'; import { Height } from '../../../../ibc/core/client/v1/client'; export const protobufPackage = 'ibc.lightclients.localhost.v1'; /** * ClientState defines a loopback (localhost) client. It requires (read-only) * access to keys outside the client prefix. */ export interface ClientState { /** self chain ID */ chainId: string; /** self latest block height */ height?: Height; } const baseClientState: object = { chainId: '' }; export const ClientState = { encode(message: ClientState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { if (message.chainId !== '') { writer.uint32(10).string(message.chainId); } if (message.height !== undefined) { Height.encode(message.height, writer.uint32(18).fork()).ldelim(); } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): ClientState { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseClientState } as ClientState; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: message.chainId = reader.string(); break; case 2: message.height = Height.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); break; } } return message; }, fromJSON(object: any): ClientState { const message = { ...baseClientState } as ClientState; if (object.chainId !== undefined && object.chainId !== null) { message.chainId = String(object.chainId); } else { message.chainId = ''; } if (object.height !== undefined && object.height !== null) { message.height = Height.fromJSON(object.height); } else { message.height = undefined; } return message; }, toJSON(message: ClientState): unknown { const obj: any = {}; message.chainId !== undefined && (obj.chainId = message.chainId); message.height !== undefined && (obj.height = message.height ? Height.toJSON(message.height) : undefined); return obj; }, fromPartial(object: DeepPartial): ClientState { const message = { ...baseClientState } as ClientState; if (object.chainId !== undefined && object.chainId !== null) { message.chainId = object.chainId; } else { message.chainId = ''; } if (object.height !== undefined && object.height !== null) { message.height = Height.fromPartial(object.height); } else { message.height = undefined; } return message; }, }; type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined | Long; export type DeepPartial = T extends Builtin ? T : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; if (_m0.util.Long !== Long) { _m0.util.Long = Long as any; _m0.configure(); }