import { Params } from "./auth"; import { Any } from "../../../google/protobuf/any"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial } from "@osmonauts/helpers"; /** GenesisState defines the auth module's genesis state. */ export interface GenesisState { /** params defines all the paramaters of the module. */ params: Params; /** accounts are the accounts present at genesis. */ accounts: Any[]; } function createBaseGenesisState(): GenesisState { return { params: undefined, accounts: [] }; } export const GenesisState = { encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); } for (const v of message.accounts) { Any.encode(v!, writer.uint32(18).fork()).ldelim(); } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGenesisState(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: message.params = Params.decode(reader, reader.uint32()); break; case 2: message.accounts.push(Any.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); break; } } return message; }, fromJSON(object: any): GenesisState { return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, accounts: Array.isArray(object?.accounts) ? object.accounts.map((e: any) => Any.fromJSON(e)) : [] }; }, toJSON(message: GenesisState): unknown { const obj: any = {}; message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); if (message.accounts) { obj.accounts = message.accounts.map(e => e ? Any.toJSON(e) : undefined); } else { obj.accounts = []; } return obj; }, fromPartial(object: DeepPartial): GenesisState { const message = createBaseGenesisState(); message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; message.accounts = object.accounts?.map(e => Any.fromPartial(e)) || []; return message; } };