UNPKG

@cheqd/ts-proto

Version:

A TypeScript package for all transpiled cheqd ProtoBuf definitions.

98 lines 3.47 kB
// Code generated by protoc-gen-ts_proto. DO NOT EDIT. // versions: // protoc-gen-ts_proto v2.3.0 // protoc unknown // source: feeabstraction/feeabs/v1beta1/genesis.proto /* eslint-disable */ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { EpochInfo } from "./epoch.js"; import { Params } from "./params.js"; function createBaseGenesisState() { return { params: undefined, epochs: [], portId: "" }; } export const GenesisState = { encode(message, writer = new BinaryWriter()) { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).join(); } for (const v of message.epochs) { EpochInfo.encode(v, writer.uint32(18).fork()).join(); } if (message.portId !== "") { writer.uint32(26).string(message.portId); } 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 = createBaseGenesisState(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.params = Params.decode(reader, reader.uint32()); continue; } case 2: { if (tag !== 18) { break; } message.epochs.push(EpochInfo.decode(reader, reader.uint32())); continue; } case 3: { if (tag !== 26) { break; } message.portId = reader.string(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, epochs: globalThis.Array.isArray(object?.epochs) ? object.epochs.map((e) => EpochInfo.fromJSON(e)) : [], portId: isSet(object.portId) ? globalThis.String(object.portId) : "", }; }, toJSON(message) { const obj = {}; if (message.params !== undefined) { obj.params = Params.toJSON(message.params); } if (message.epochs?.length) { obj.epochs = message.epochs.map((e) => EpochInfo.toJSON(e)); } if (message.portId !== "") { obj.portId = message.portId; } return obj; }, create(base) { return GenesisState.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseGenesisState(); message.params = (object.params !== undefined && object.params !== null) ? Params.fromPartial(object.params) : undefined; message.epochs = object.epochs?.map((e) => EpochInfo.fromPartial(e)) || []; message.portId = object.portId ?? ""; return message; }, }; function isSet(value) { return value !== null && value !== undefined; } //# sourceMappingURL=genesis.js.map