import { Duration } from "../../../google/protobuf/duration"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, Long } from "@osmonauts/helpers"; export interface Params { /** * minted_denom is the denomination of the coin expected to be minted by the * minting module. Pool-incentives module doesn’t actually mint the coin * itself, but rather manages the distribution of coins that matches the * defined minted_denom. */ minted_denom: string; } export interface LockableDurationsInfo { lockable_durations: Duration[]; } export interface DistrInfo { total_weight: string; records: DistrRecord[]; } export interface DistrRecord { gauge_id: Long; weight: string; } function createBaseParams(): Params { return { minted_denom: "" }; } export const Params = { encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { if (message.minted_denom !== "") { writer.uint32(10).string(message.minted_denom); } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): Params { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseParams(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: message.minted_denom = reader.string(); break; default: reader.skipType(tag & 7); break; } } return message; }, fromJSON(object: any): Params { return { minted_denom: isSet(object.minted_denom) ? String(object.minted_denom) : "" }; }, toJSON(message: Params): unknown { const obj: any = {}; message.minted_denom !== undefined && (obj.minted_denom = message.minted_denom); return obj; }, fromPartial(object: DeepPartial): Params { const message = createBaseParams(); message.minted_denom = object.minted_denom ?? ""; return message; } }; function createBaseLockableDurationsInfo(): LockableDurationsInfo { return { lockable_durations: [] }; } export const LockableDurationsInfo = { encode(message: LockableDurationsInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { for (const v of message.lockable_durations) { Duration.encode(v!, writer.uint32(10).fork()).ldelim(); } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): LockableDurationsInfo { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseLockableDurationsInfo(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: message.lockable_durations.push(Duration.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); break; } } return message; }, fromJSON(object: any): LockableDurationsInfo { return { lockable_durations: Array.isArray(object?.lockable_durations) ? object.lockable_durations.map((e: any) => Duration.fromJSON(e)) : [] }; }, toJSON(message: LockableDurationsInfo): unknown { const obj: any = {}; if (message.lockable_durations) { obj.lockable_durations = message.lockable_durations.map(e => e ? Duration.toJSON(e) : undefined); } else { obj.lockable_durations = []; } return obj; }, fromPartial(object: DeepPartial): LockableDurationsInfo { const message = createBaseLockableDurationsInfo(); message.lockable_durations = object.lockable_durations?.map(e => Duration.fromPartial(e)) || []; return message; } }; function createBaseDistrInfo(): DistrInfo { return { total_weight: "", records: [] }; } export const DistrInfo = { encode(message: DistrInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { if (message.total_weight !== "") { writer.uint32(10).string(message.total_weight); } for (const v of message.records) { DistrRecord.encode(v!, writer.uint32(18).fork()).ldelim(); } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): DistrInfo { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDistrInfo(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: message.total_weight = reader.string(); break; case 2: message.records.push(DistrRecord.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); break; } } return message; }, fromJSON(object: any): DistrInfo { return { total_weight: isSet(object.total_weight) ? String(object.total_weight) : "", records: Array.isArray(object?.records) ? object.records.map((e: any) => DistrRecord.fromJSON(e)) : [] }; }, toJSON(message: DistrInfo): unknown { const obj: any = {}; message.total_weight !== undefined && (obj.total_weight = message.total_weight); if (message.records) { obj.records = message.records.map(e => e ? DistrRecord.toJSON(e) : undefined); } else { obj.records = []; } return obj; }, fromPartial(object: DeepPartial): DistrInfo { const message = createBaseDistrInfo(); message.total_weight = object.total_weight ?? ""; message.records = object.records?.map(e => DistrRecord.fromPartial(e)) || []; return message; } }; function createBaseDistrRecord(): DistrRecord { return { gauge_id: Long.UZERO, weight: "" }; } export const DistrRecord = { encode(message: DistrRecord, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { if (!message.gauge_id.isZero()) { writer.uint32(8).uint64(message.gauge_id); } if (message.weight !== "") { writer.uint32(18).string(message.weight); } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): DistrRecord { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDistrRecord(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: message.gauge_id = (reader.uint64() as Long); break; case 2: message.weight = reader.string(); break; default: reader.skipType(tag & 7); break; } } return message; }, fromJSON(object: any): DistrRecord { return { gauge_id: isSet(object.gauge_id) ? Long.fromString(object.gauge_id) : Long.UZERO, weight: isSet(object.weight) ? String(object.weight) : "" }; }, toJSON(message: DistrRecord): unknown { const obj: any = {}; message.gauge_id !== undefined && (obj.gauge_id = (message.gauge_id || Long.UZERO).toString()); message.weight !== undefined && (obj.weight = message.weight); return obj; }, fromPartial(object: DeepPartial): DistrRecord { const message = createBaseDistrRecord(); message.gauge_id = object.gauge_id !== undefined && object.gauge_id !== null ? Long.fromValue(object.gauge_id) : Long.UZERO; message.weight = object.weight ?? ""; return message; } };