UNPKG

@cheqd/ts-proto

Version:

A TypeScript package for all transpiled cheqd ProtoBuf definitions.

1,623 lines (1,436 loc) 85.3 kB
// Code generated by protoc-gen-ts_proto. DO NOT EDIT. // versions: // protoc-gen-ts_proto v2.11.4 // protoc unknown // source: cheqd/oracle/v2/query.proto /* eslint-disable */ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { DecCoin } from "../../../cosmos/base/v1beta1/coin.js"; import { AggregateExchangeRatePrevote, AggregateExchangeRateVote, Params, PriceStamp, ValidatorRewardSet, } from "./oracle.js"; /** * QueryExchangeRates is the request type for the Query/ExchangeRate RPC * method. */ export interface QueryExchangeRates { /** denom defines the denomination to query for. */ denom: string; } /** * QueryExchangeRatesResponse is response type for the * Query/ExchangeRates RPC method. */ export interface QueryExchangeRatesResponse { /** * exchange_rates defines a list of the exchange rate for all whitelisted * denoms. */ exchangeRates: DecCoin[]; } /** * QueryActiveExchangeRates is the request type for the * Query/ActiveExchangeRates RPC method. */ export interface QueryActiveExchangeRates { } /** * QueryActiveExchangeRatesResponse is response type for the * Query/ActiveExchangeRates RPC method. */ export interface QueryActiveExchangeRatesResponse { /** * activeRates defines a list of the denomination which oracle prices aggreed * upon. */ activeRates: string[]; } /** * QueryFeederDelegation is the request type for the * Query/FeederDelegation RPC method. */ export interface QueryFeederDelegation { /** validator defines the validator address to query for. */ validatorAddr: string; } /** * QueryFeederDelegationResponse is response type for the * Query/FeederDelegation RPC method. */ export interface QueryFeederDelegationResponse { /** feeder_addr defines the feeder delegation of a validator */ feederAddr: string; } /** * QueryMissCounter is the request type for the Query/MissCounter RPC * method. */ export interface QueryMissCounter { /** validator defines the validator address to query for. */ validatorAddr: string; } /** * QueryMissCounterResponse is response type for the * Query/MissCounter RPC method. */ export interface QueryMissCounterResponse { /** miss_counter defines the oracle miss counter of a validator */ missCounter: bigint; } /** * QuerySlashWindow is the request type for the * Query/SlashWindow RPC method. */ export interface QuerySlashWindow { } /** * QuerySlashWindowResponse is response type for the * Query/SlashWindow RPC method. */ export interface QuerySlashWindowResponse { /** * window_progress defines the number of voting periods * since the last slashing event would have taken place. */ windowProgress: bigint; } /** * QueryAggregatePrevote is the request type for the * Query/AggregatePrevote RPC method. */ export interface QueryAggregatePrevote { /** validator defines the validator address to query for. */ validatorAddr: string; } /** * QueryAggregatePrevoteResponse is response type for the * Query/AggregatePrevote RPC method. */ export interface QueryAggregatePrevoteResponse { /** * aggregate_prevote defines oracle aggregate prevote submitted by a validator * in the current vote period */ aggregatePrevote: AggregateExchangeRatePrevote | undefined; } /** * QueryAggregatePrevotes is the request type for the * Query/AggregatePrevotes RPC method. */ export interface QueryAggregatePrevotes { } /** * QueryAggregatePrevotesResponse is response type for the * Query/AggregatePrevotes RPC method. */ export interface QueryAggregatePrevotesResponse { /** * aggregate_prevotes defines all oracle aggregate prevotes submitted in the * current vote period */ aggregatePrevotes: AggregateExchangeRatePrevote[]; } /** * QueryAggregateVote is the request type for the Query/AggregateVote RPC * method. */ export interface QueryAggregateVote { /** validator defines the validator address to query for. */ validatorAddr: string; } /** * QueryAggregateVoteResponse is response type for the * Query/AggregateVote RPC method. */ export interface QueryAggregateVoteResponse { /** * aggregate_vote defines oracle aggregate vote submitted by a validator in * the current vote period */ aggregateVote: AggregateExchangeRateVote | undefined; } /** * QueryAggregateVotes is the request type for the Query/AggregateVotes * RPC method. */ export interface QueryAggregateVotes { } /** * QueryAggregateVotesResponse is response type for the * Query/AggregateVotes RPC method. */ export interface QueryAggregateVotesResponse { /** * aggregate_votes defines all oracle aggregate votes submitted in the current * vote period */ aggregateVotes: AggregateExchangeRateVote[]; } /** QueryParams is the request type for the Query/Params RPC method. */ export interface QueryParams { } /** QueryParamsResponse is the response type for the Query/Params RPC method. */ export interface QueryParamsResponse { /** params defines the parameters of the module. */ params: Params | undefined; } /** QueryMedians is the request type for the Query/Medians RPC Response. */ export interface QueryMedians { /** denom defines the denomination to query for. */ denom: string; /** * numStamps defines the number of median stamps to query for. numStamps * must be greater than 0. */ numStamps: number; } /** * QueryMediansResponse is response type for the * Query/Medians RPC method. */ export interface QueryMediansResponse { /** medians defines a list of the medians for all stamped denoms. */ medians: PriceStamp[]; } /** * QueryMedianDeviations is the request type for the Query/MedianDeviations RPC * Response. */ export interface QueryMedianDeviations { /** denom defines the denomination to query for. */ denom: string; } /** * QueryMedianDeviationsResponse is response type for the * Query/MedianDeviations RPC method. */ export interface QueryMedianDeviationsResponse { /** medians defines a list of the median deviations for all stamped denoms. */ medianDeviations: PriceStamp[]; } /** QueryValidatorRewardSet is the request type for the Query/ValidatorRewardSet RPC method. */ export interface QueryValidatorRewardSet { } /** QueryValidatorRewardSetResponse is the response type for the Query/ValidatorRewardSet RPC method. */ export interface QueryValidatorRewardSetResponse { validators: ValidatorRewardSet | undefined; } export interface QueryEMARequest { denom: string; } export interface QueryEMAResponse { price: string; } export interface QueryWMARequest { denom: string; /** "BALANCED", "RECENT", etc. */ strategy: string; /** Only used if strategy == "CUSTOM" */ customWeights: bigint[]; } export interface QueryWMAResponse { price: string; } export interface QuerySMARequest { denom: string; } export interface QuerySMAResponse { price: string; } export interface ConvertUSDCtoCHEQRequest { /** e.g., "1000000usdc" */ amount: string; /** "sma", "ema", or "wma" */ maType: string; /** "daily", "hourly", "custom" (optional unless wma is chosen) */ wmaStrategy: string; /** only used if strategy == custom */ customWeights: number[]; } export interface ConvertUSDCtoCHEQResponse { /** e.g., "25000000ncheq" */ amount: string; } function createBaseQueryExchangeRates(): QueryExchangeRates { return { denom: "" }; } export const QueryExchangeRates: MessageFns<QueryExchangeRates> = { encode(message: QueryExchangeRates, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): QueryExchangeRates { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryExchangeRates(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.denom = reader.string(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object: any): QueryExchangeRates { return { denom: isSet(object.denom) ? globalThis.String(object.denom) : "" }; }, toJSON(message: QueryExchangeRates): unknown { const obj: any = {}; if (message.denom !== "") { obj.denom = message.denom; } return obj; }, create<I extends Exact<DeepPartial<QueryExchangeRates>, I>>(base?: I): QueryExchangeRates { return QueryExchangeRates.fromPartial(base ?? ({} as any)); }, fromPartial<I extends Exact<DeepPartial<QueryExchangeRates>, I>>(object: I): QueryExchangeRates { const message = createBaseQueryExchangeRates(); message.denom = object.denom ?? ""; return message; }, }; function createBaseQueryExchangeRatesResponse(): QueryExchangeRatesResponse { return { exchangeRates: [] }; } export const QueryExchangeRatesResponse: MessageFns<QueryExchangeRatesResponse> = { encode(message: QueryExchangeRatesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.exchangeRates) { DecCoin.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): QueryExchangeRatesResponse { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryExchangeRatesResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.exchangeRates.push(DecCoin.decode(reader, reader.uint32())); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object: any): QueryExchangeRatesResponse { return { exchangeRates: globalThis.Array.isArray(object?.exchangeRates) ? object.exchangeRates.map((e: any) => DecCoin.fromJSON(e)) : globalThis.Array.isArray(object?.exchange_rates) ? object.exchange_rates.map((e: any) => DecCoin.fromJSON(e)) : [], }; }, toJSON(message: QueryExchangeRatesResponse): unknown { const obj: any = {}; if (message.exchangeRates?.length) { obj.exchangeRates = message.exchangeRates.map((e) => DecCoin.toJSON(e)); } return obj; }, create<I extends Exact<DeepPartial<QueryExchangeRatesResponse>, I>>(base?: I): QueryExchangeRatesResponse { return QueryExchangeRatesResponse.fromPartial(base ?? ({} as any)); }, fromPartial<I extends Exact<DeepPartial<QueryExchangeRatesResponse>, I>>(object: I): QueryExchangeRatesResponse { const message = createBaseQueryExchangeRatesResponse(); message.exchangeRates = object.exchangeRates?.map((e) => DecCoin.fromPartial(e)) || []; return message; }, }; function createBaseQueryActiveExchangeRates(): QueryActiveExchangeRates { return {}; } export const QueryActiveExchangeRates: MessageFns<QueryActiveExchangeRates> = { encode(_: QueryActiveExchangeRates, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): QueryActiveExchangeRates { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryActiveExchangeRates(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(_: any): QueryActiveExchangeRates { return {}; }, toJSON(_: QueryActiveExchangeRates): unknown { const obj: any = {}; return obj; }, create<I extends Exact<DeepPartial<QueryActiveExchangeRates>, I>>(base?: I): QueryActiveExchangeRates { return QueryActiveExchangeRates.fromPartial(base ?? ({} as any)); }, fromPartial<I extends Exact<DeepPartial<QueryActiveExchangeRates>, I>>(_: I): QueryActiveExchangeRates { const message = createBaseQueryActiveExchangeRates(); return message; }, }; function createBaseQueryActiveExchangeRatesResponse(): QueryActiveExchangeRatesResponse { return { activeRates: [] }; } export const QueryActiveExchangeRatesResponse: MessageFns<QueryActiveExchangeRatesResponse> = { encode(message: QueryActiveExchangeRatesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.activeRates) { writer.uint32(10).string(v!); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): QueryActiveExchangeRatesResponse { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryActiveExchangeRatesResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.activeRates.push(reader.string()); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object: any): QueryActiveExchangeRatesResponse { return { activeRates: globalThis.Array.isArray(object?.activeRates) ? object.activeRates.map((e: any) => globalThis.String(e)) : globalThis.Array.isArray(object?.active_rates) ? object.active_rates.map((e: any) => globalThis.String(e)) : [], }; }, toJSON(message: QueryActiveExchangeRatesResponse): unknown { const obj: any = {}; if (message.activeRates?.length) { obj.activeRates = message.activeRates; } return obj; }, create<I extends Exact<DeepPartial<QueryActiveExchangeRatesResponse>, I>>( base?: I, ): QueryActiveExchangeRatesResponse { return QueryActiveExchangeRatesResponse.fromPartial(base ?? ({} as any)); }, fromPartial<I extends Exact<DeepPartial<QueryActiveExchangeRatesResponse>, I>>( object: I, ): QueryActiveExchangeRatesResponse { const message = createBaseQueryActiveExchangeRatesResponse(); message.activeRates = object.activeRates?.map((e) => e) || []; return message; }, }; function createBaseQueryFeederDelegation(): QueryFeederDelegation { return { validatorAddr: "" }; } export const QueryFeederDelegation: MessageFns<QueryFeederDelegation> = { encode(message: QueryFeederDelegation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.validatorAddr !== "") { writer.uint32(10).string(message.validatorAddr); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): QueryFeederDelegation { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryFeederDelegation(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.validatorAddr = reader.string(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object: any): QueryFeederDelegation { return { validatorAddr: isSet(object.validatorAddr) ? globalThis.String(object.validatorAddr) : isSet(object.validator_addr) ? globalThis.String(object.validator_addr) : "", }; }, toJSON(message: QueryFeederDelegation): unknown { const obj: any = {}; if (message.validatorAddr !== "") { obj.validatorAddr = message.validatorAddr; } return obj; }, create<I extends Exact<DeepPartial<QueryFeederDelegation>, I>>(base?: I): QueryFeederDelegation { return QueryFeederDelegation.fromPartial(base ?? ({} as any)); }, fromPartial<I extends Exact<DeepPartial<QueryFeederDelegation>, I>>(object: I): QueryFeederDelegation { const message = createBaseQueryFeederDelegation(); message.validatorAddr = object.validatorAddr ?? ""; return message; }, }; function createBaseQueryFeederDelegationResponse(): QueryFeederDelegationResponse { return { feederAddr: "" }; } export const QueryFeederDelegationResponse: MessageFns<QueryFeederDelegationResponse> = { encode(message: QueryFeederDelegationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.feederAddr !== "") { writer.uint32(10).string(message.feederAddr); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): QueryFeederDelegationResponse { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryFeederDelegationResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.feederAddr = reader.string(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object: any): QueryFeederDelegationResponse { return { feederAddr: isSet(object.feederAddr) ? globalThis.String(object.feederAddr) : isSet(object.feeder_addr) ? globalThis.String(object.feeder_addr) : "", }; }, toJSON(message: QueryFeederDelegationResponse): unknown { const obj: any = {}; if (message.feederAddr !== "") { obj.feederAddr = message.feederAddr; } return obj; }, create<I extends Exact<DeepPartial<QueryFeederDelegationResponse>, I>>(base?: I): QueryFeederDelegationResponse { return QueryFeederDelegationResponse.fromPartial(base ?? ({} as any)); }, fromPartial<I extends Exact<DeepPartial<QueryFeederDelegationResponse>, I>>( object: I, ): QueryFeederDelegationResponse { const message = createBaseQueryFeederDelegationResponse(); message.feederAddr = object.feederAddr ?? ""; return message; }, }; function createBaseQueryMissCounter(): QueryMissCounter { return { validatorAddr: "" }; } export const QueryMissCounter: MessageFns<QueryMissCounter> = { encode(message: QueryMissCounter, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.validatorAddr !== "") { writer.uint32(10).string(message.validatorAddr); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): QueryMissCounter { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryMissCounter(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.validatorAddr = reader.string(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object: any): QueryMissCounter { return { validatorAddr: isSet(object.validatorAddr) ? globalThis.String(object.validatorAddr) : isSet(object.validator_addr) ? globalThis.String(object.validator_addr) : "", }; }, toJSON(message: QueryMissCounter): unknown { const obj: any = {}; if (message.validatorAddr !== "") { obj.validatorAddr = message.validatorAddr; } return obj; }, create<I extends Exact<DeepPartial<QueryMissCounter>, I>>(base?: I): QueryMissCounter { return QueryMissCounter.fromPartial(base ?? ({} as any)); }, fromPartial<I extends Exact<DeepPartial<QueryMissCounter>, I>>(object: I): QueryMissCounter { const message = createBaseQueryMissCounter(); message.validatorAddr = object.validatorAddr ?? ""; return message; }, }; function createBaseQueryMissCounterResponse(): QueryMissCounterResponse { return { missCounter: 0n }; } export const QueryMissCounterResponse: MessageFns<QueryMissCounterResponse> = { encode(message: QueryMissCounterResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.missCounter !== 0n) { if (BigInt.asUintN(64, message.missCounter) !== message.missCounter) { throw new globalThis.Error("value provided for field message.missCounter of type uint64 too large"); } writer.uint32(8).uint64(message.missCounter); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): QueryMissCounterResponse { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryMissCounterResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 8) { break; } message.missCounter = reader.uint64() as bigint; continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object: any): QueryMissCounterResponse { return { missCounter: isSet(object.missCounter) ? BigInt(object.missCounter) : isSet(object.miss_counter) ? BigInt(object.miss_counter) : 0n, }; }, toJSON(message: QueryMissCounterResponse): unknown { const obj: any = {}; if (message.missCounter !== 0n) { obj.missCounter = message.missCounter.toString(); } return obj; }, create<I extends Exact<DeepPartial<QueryMissCounterResponse>, I>>(base?: I): QueryMissCounterResponse { return QueryMissCounterResponse.fromPartial(base ?? ({} as any)); }, fromPartial<I extends Exact<DeepPartial<QueryMissCounterResponse>, I>>(object: I): QueryMissCounterResponse { const message = createBaseQueryMissCounterResponse(); message.missCounter = object.missCounter ?? 0n; return message; }, }; function createBaseQuerySlashWindow(): QuerySlashWindow { return {}; } export const QuerySlashWindow: MessageFns<QuerySlashWindow> = { encode(_: QuerySlashWindow, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): QuerySlashWindow { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQuerySlashWindow(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(_: any): QuerySlashWindow { return {}; }, toJSON(_: QuerySlashWindow): unknown { const obj: any = {}; return obj; }, create<I extends Exact<DeepPartial<QuerySlashWindow>, I>>(base?: I): QuerySlashWindow { return QuerySlashWindow.fromPartial(base ?? ({} as any)); }, fromPartial<I extends Exact<DeepPartial<QuerySlashWindow>, I>>(_: I): QuerySlashWindow { const message = createBaseQuerySlashWindow(); return message; }, }; function createBaseQuerySlashWindowResponse(): QuerySlashWindowResponse { return { windowProgress: 0n }; } export const QuerySlashWindowResponse: MessageFns<QuerySlashWindowResponse> = { encode(message: QuerySlashWindowResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.windowProgress !== 0n) { if (BigInt.asUintN(64, message.windowProgress) !== message.windowProgress) { throw new globalThis.Error("value provided for field message.windowProgress of type uint64 too large"); } writer.uint32(8).uint64(message.windowProgress); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): QuerySlashWindowResponse { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQuerySlashWindowResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 8) { break; } message.windowProgress = reader.uint64() as bigint; continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object: any): QuerySlashWindowResponse { return { windowProgress: isSet(object.windowProgress) ? BigInt(object.windowProgress) : isSet(object.window_progress) ? BigInt(object.window_progress) : 0n, }; }, toJSON(message: QuerySlashWindowResponse): unknown { const obj: any = {}; if (message.windowProgress !== 0n) { obj.windowProgress = message.windowProgress.toString(); } return obj; }, create<I extends Exact<DeepPartial<QuerySlashWindowResponse>, I>>(base?: I): QuerySlashWindowResponse { return QuerySlashWindowResponse.fromPartial(base ?? ({} as any)); }, fromPartial<I extends Exact<DeepPartial<QuerySlashWindowResponse>, I>>(object: I): QuerySlashWindowResponse { const message = createBaseQuerySlashWindowResponse(); message.windowProgress = object.windowProgress ?? 0n; return message; }, }; function createBaseQueryAggregatePrevote(): QueryAggregatePrevote { return { validatorAddr: "" }; } export const QueryAggregatePrevote: MessageFns<QueryAggregatePrevote> = { encode(message: QueryAggregatePrevote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.validatorAddr !== "") { writer.uint32(10).string(message.validatorAddr); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): QueryAggregatePrevote { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryAggregatePrevote(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.validatorAddr = reader.string(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object: any): QueryAggregatePrevote { return { validatorAddr: isSet(object.validatorAddr) ? globalThis.String(object.validatorAddr) : isSet(object.validator_addr) ? globalThis.String(object.validator_addr) : "", }; }, toJSON(message: QueryAggregatePrevote): unknown { const obj: any = {}; if (message.validatorAddr !== "") { obj.validatorAddr = message.validatorAddr; } return obj; }, create<I extends Exact<DeepPartial<QueryAggregatePrevote>, I>>(base?: I): QueryAggregatePrevote { return QueryAggregatePrevote.fromPartial(base ?? ({} as any)); }, fromPartial<I extends Exact<DeepPartial<QueryAggregatePrevote>, I>>(object: I): QueryAggregatePrevote { const message = createBaseQueryAggregatePrevote(); message.validatorAddr = object.validatorAddr ?? ""; return message; }, }; function createBaseQueryAggregatePrevoteResponse(): QueryAggregatePrevoteResponse { return { aggregatePrevote: undefined }; } export const QueryAggregatePrevoteResponse: MessageFns<QueryAggregatePrevoteResponse> = { encode(message: QueryAggregatePrevoteResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.aggregatePrevote !== undefined) { AggregateExchangeRatePrevote.encode(message.aggregatePrevote, writer.uint32(10).fork()).join(); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): QueryAggregatePrevoteResponse { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryAggregatePrevoteResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.aggregatePrevote = AggregateExchangeRatePrevote.decode(reader, reader.uint32()); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object: any): QueryAggregatePrevoteResponse { return { aggregatePrevote: isSet(object.aggregatePrevote) ? AggregateExchangeRatePrevote.fromJSON(object.aggregatePrevote) : isSet(object.aggregate_prevote) ? AggregateExchangeRatePrevote.fromJSON(object.aggregate_prevote) : undefined, }; }, toJSON(message: QueryAggregatePrevoteResponse): unknown { const obj: any = {}; if (message.aggregatePrevote !== undefined) { obj.aggregatePrevote = AggregateExchangeRatePrevote.toJSON(message.aggregatePrevote); } return obj; }, create<I extends Exact<DeepPartial<QueryAggregatePrevoteResponse>, I>>(base?: I): QueryAggregatePrevoteResponse { return QueryAggregatePrevoteResponse.fromPartial(base ?? ({} as any)); }, fromPartial<I extends Exact<DeepPartial<QueryAggregatePrevoteResponse>, I>>( object: I, ): QueryAggregatePrevoteResponse { const message = createBaseQueryAggregatePrevoteResponse(); message.aggregatePrevote = (object.aggregatePrevote !== undefined && object.aggregatePrevote !== null) ? AggregateExchangeRatePrevote.fromPartial(object.aggregatePrevote) : undefined; return message; }, }; function createBaseQueryAggregatePrevotes(): QueryAggregatePrevotes { return {}; } export const QueryAggregatePrevotes: MessageFns<QueryAggregatePrevotes> = { encode(_: QueryAggregatePrevotes, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): QueryAggregatePrevotes { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryAggregatePrevotes(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(_: any): QueryAggregatePrevotes { return {}; }, toJSON(_: QueryAggregatePrevotes): unknown { const obj: any = {}; return obj; }, create<I extends Exact<DeepPartial<QueryAggregatePrevotes>, I>>(base?: I): QueryAggregatePrevotes { return QueryAggregatePrevotes.fromPartial(base ?? ({} as any)); }, fromPartial<I extends Exact<DeepPartial<QueryAggregatePrevotes>, I>>(_: I): QueryAggregatePrevotes { const message = createBaseQueryAggregatePrevotes(); return message; }, }; function createBaseQueryAggregatePrevotesResponse(): QueryAggregatePrevotesResponse { return { aggregatePrevotes: [] }; } export const QueryAggregatePrevotesResponse: MessageFns<QueryAggregatePrevotesResponse> = { encode(message: QueryAggregatePrevotesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.aggregatePrevotes) { AggregateExchangeRatePrevote.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): QueryAggregatePrevotesResponse { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryAggregatePrevotesResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.aggregatePrevotes.push(AggregateExchangeRatePrevote.decode(reader, reader.uint32())); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object: any): QueryAggregatePrevotesResponse { return { aggregatePrevotes: globalThis.Array.isArray(object?.aggregatePrevotes) ? object.aggregatePrevotes.map((e: any) => AggregateExchangeRatePrevote.fromJSON(e)) : globalThis.Array.isArray(object?.aggregate_prevotes) ? object.aggregate_prevotes.map((e: any) => AggregateExchangeRatePrevote.fromJSON(e)) : [], }; }, toJSON(message: QueryAggregatePrevotesResponse): unknown { const obj: any = {}; if (message.aggregatePrevotes?.length) { obj.aggregatePrevotes = message.aggregatePrevotes.map((e) => AggregateExchangeRatePrevote.toJSON(e)); } return obj; }, create<I extends Exact<DeepPartial<QueryAggregatePrevotesResponse>, I>>(base?: I): QueryAggregatePrevotesResponse { return QueryAggregatePrevotesResponse.fromPartial(base ?? ({} as any)); }, fromPartial<I extends Exact<DeepPartial<QueryAggregatePrevotesResponse>, I>>( object: I, ): QueryAggregatePrevotesResponse { const message = createBaseQueryAggregatePrevotesResponse(); message.aggregatePrevotes = object.aggregatePrevotes?.map((e) => AggregateExchangeRatePrevote.fromPartial(e)) || []; return message; }, }; function createBaseQueryAggregateVote(): QueryAggregateVote { return { validatorAddr: "" }; } export const QueryAggregateVote: MessageFns<QueryAggregateVote> = { encode(message: QueryAggregateVote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.validatorAddr !== "") { writer.uint32(10).string(message.validatorAddr); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): QueryAggregateVote { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryAggregateVote(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.validatorAddr = reader.string(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object: any): QueryAggregateVote { return { validatorAddr: isSet(object.validatorAddr) ? globalThis.String(object.validatorAddr) : isSet(object.validator_addr) ? globalThis.String(object.validator_addr) : "", }; }, toJSON(message: QueryAggregateVote): unknown { const obj: any = {}; if (message.validatorAddr !== "") { obj.validatorAddr = message.validatorAddr; } return obj; }, create<I extends Exact<DeepPartial<QueryAggregateVote>, I>>(base?: I): QueryAggregateVote { return QueryAggregateVote.fromPartial(base ?? ({} as any)); }, fromPartial<I extends Exact<DeepPartial<QueryAggregateVote>, I>>(object: I): QueryAggregateVote { const message = createBaseQueryAggregateVote(); message.validatorAddr = object.validatorAddr ?? ""; return message; }, }; function createBaseQueryAggregateVoteResponse(): QueryAggregateVoteResponse { return { aggregateVote: undefined }; } export const QueryAggregateVoteResponse: MessageFns<QueryAggregateVoteResponse> = { encode(message: QueryAggregateVoteResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.aggregateVote !== undefined) { AggregateExchangeRateVote.encode(message.aggregateVote, writer.uint32(10).fork()).join(); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): QueryAggregateVoteResponse { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryAggregateVoteResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.aggregateVote = AggregateExchangeRateVote.decode(reader, reader.uint32()); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object: any): QueryAggregateVoteResponse { return { aggregateVote: isSet(object.aggregateVote) ? AggregateExchangeRateVote.fromJSON(object.aggregateVote) : isSet(object.aggregate_vote) ? AggregateExchangeRateVote.fromJSON(object.aggregate_vote) : undefined, }; }, toJSON(message: QueryAggregateVoteResponse): unknown { const obj: any = {}; if (message.aggregateVote !== undefined) { obj.aggregateVote = AggregateExchangeRateVote.toJSON(message.aggregateVote); } return obj; }, create<I extends Exact<DeepPartial<QueryAggregateVoteResponse>, I>>(base?: I): QueryAggregateVoteResponse { return QueryAggregateVoteResponse.fromPartial(base ?? ({} as any)); }, fromPartial<I extends Exact<DeepPartial<QueryAggregateVoteResponse>, I>>(object: I): QueryAggregateVoteResponse { const message = createBaseQueryAggregateVoteResponse(); message.aggregateVote = (object.aggregateVote !== undefined && object.aggregateVote !== null) ? AggregateExchangeRateVote.fromPartial(object.aggregateVote) : undefined; return message; }, }; function createBaseQueryAggregateVotes(): QueryAggregateVotes { return {}; } export const QueryAggregateVotes: MessageFns<QueryAggregateVotes> = { encode(_: QueryAggregateVotes, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): QueryAggregateVotes { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryAggregateVotes(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(_: any): QueryAggregateVotes { return {}; }, toJSON(_: QueryAggregateVotes): unknown { const obj: any = {}; return obj; }, create<I extends Exact<DeepPartial<QueryAggregateVotes>, I>>(base?: I): QueryAggregateVotes { return QueryAggregateVotes.fromPartial(base ?? ({} as any)); }, fromPartial<I extends Exact<DeepPartial<QueryAggregateVotes>, I>>(_: I): QueryAggregateVotes { const message = createBaseQueryAggregateVotes(); return message; }, }; function createBaseQueryAggregateVotesResponse(): QueryAggregateVotesResponse { return { aggregateVotes: [] }; } export const QueryAggregateVotesResponse: MessageFns<QueryAggregateVotesResponse> = { encode(message: QueryAggregateVotesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.aggregateVotes) { AggregateExchangeRateVote.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): QueryAggregateVotesResponse { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryAggregateVotesResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.aggregateVotes.push(AggregateExchangeRateVote.decode(reader, reader.uint32())); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object: any): QueryAggregateVotesResponse { return { aggregateVotes: globalThis.Array.isArray(object?.aggregateVotes) ? object.aggregateVotes.map((e: any) => AggregateExchangeRateVote.fromJSON(e)) : globalThis.Array.isArray(object?.aggregate_votes) ? object.aggregate_votes.map((e: any) => AggregateExchangeRateVote.fromJSON(e)) : [], }; }, toJSON(message: QueryAggregateVotesResponse): unknown { const obj: any = {}; if (message.aggregateVotes?.length) { obj.aggregateVotes = message.aggregateVotes.map((e) => AggregateExchangeRateVote.toJSON(e)); } return obj; }, create<I extends Exact<DeepPartial<QueryAggregateVotesResponse>, I>>(base?: I): QueryAggregateVotesResponse { return QueryAggregateVotesResponse.fromPartial(base ?? ({} as any)); }, fromPartial<I extends Exact<DeepPartial<QueryAggregateVotesResponse>, I>>(object: I): QueryAggregateVotesResponse { const message = createBaseQueryAggregateVotesResponse(); message.aggregateVotes = object.aggregateVotes?.map((e) => AggregateExchangeRateVote.fromPartial(e)) || []; return message; }, }; function createBaseQueryParams(): QueryParams { return {}; } export const QueryParams: MessageFns<QueryParams> = { encode(_: QueryParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): QueryParams { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryParams(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(_: any): QueryParams { return {}; }, toJSON(_: QueryParams): unknown { const obj: any = {}; return obj; }, create<I extends Exact<DeepPartial<QueryParams>, I>>(base?: I): QueryParams { return QueryParams.fromPartial(base ?? ({} as any)); }, fromPartial<I extends Exact<DeepPartial<QueryParams>, I>>(_: I): QueryParams { const message = createBaseQueryParams(); return message; }, }; function createBaseQueryParamsResponse(): QueryParamsResponse { return { params: undefined }; } export const QueryParamsResponse: MessageFns<QueryParamsResponse> = { encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).join(); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryParamsResponse(); 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; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object: any): QueryParamsResponse { return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; }, toJSON(message: QueryParamsResponse): unknown { const obj: any = {}; if (message.params !== undefined) { obj.params = Params.toJSON(message.params); } return obj; }, create<I extends Exact<DeepPartial<QueryParamsResponse>, I>>(base?: I): QueryParamsResponse { return QueryParamsResponse.fromPartial(base ?? ({} as any)); }, fromPartial<I extends Exact<DeepPartial<QueryParamsResponse>, I>>(object: I): QueryParamsResponse { const message = createBaseQueryParamsResponse(); message.params = (object.params !== undefined && object.params !== null) ? Params.fromPartial(object.params) : undefined; return message; }, }; function createBaseQueryMedians(): QueryMedians { return { denom: "", numStamps: 0 }; } export const QueryMedians: MessageFns<QueryMedians> = { encode(message: QueryMedians, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.denom !== "") { writer.uint32(10).string(message.denom); } if (message.numStamps !== 0) { writer.uint32(16).uint32(message.numStamps); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): QueryMedians { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryMedians(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.denom = reader.string(); continue; } case 2: { if (tag !== 16) { break; } message.numStamps = reader.uint32(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object: any): QueryMedians { return { denom: isSet(object.denom) ? globalThis.String(object.denom) : "", numStamps: isSet(object.numStamps) ? globalThis.Number(object.numStamps) : isSet(object.num_stamps) ? globalThis.Number(object.num_stamps) : 0, }; }, toJSON(message: QueryMedians): unknown { const obj: any = {}; if (message.denom !== "") { obj.denom = message.denom; } if (message.numStamps !== 0) { obj.numStamps = Math.round(message.numStamps); } return obj; }, create<I extends Exact<DeepPartial<QueryMedians>, I>>(base?: I): QueryMedians { return QueryMedians.fromPartial(base ?? ({} as any)); }, fromPartial<I extends Exact<DeepPartial<QueryMedians>, I>>(object: I): QueryMedians { const message = createBaseQueryMedians(); message.denom = object.denom ?? ""; message.numStamps = object.numStamps ?? 0; return message; }, }; function createBaseQueryMediansResponse(): QueryMediansResponse { return { medians: [] }; } export const QueryMediansResponse: MessageFns<QueryMediansResponse> = { encode(message: QueryMediansResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.medians) { PriceStamp.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): QueryMediansResponse { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseQueryMediansResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.medians.push(PriceStamp.decode(reader, reader.uint32())); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object: any): QueryMediansResponse { return { medians: globalThis.Array.isArray(object?.medians) ? object.medians.map((e: any) => PriceStamp.fromJSON(e)) : [], }; }, toJSON(message: QueryMediansResponse): unknown { const obj: any = {}; if (message.medians?.length) { obj.medians = message.medians.map((e) => PriceStamp.toJSON(e)); } return obj; }, create<I extends Exact<DeepPartial<QueryMediansResponse>, I>>(base?: I): QueryMediansResponse { return QueryMediansResponse.fromPartial(base ?? ({} as any)); }, fromPartial<I extends Exact<DeepPartial<QueryMediansResponse>, I>>(object: I): QueryMediansResponse { const message = createBaseQueryMediansResponse(); message.medians = object.medians?.map((e) => PriceStamp.fromPartial(e)) || []; return message; }, }; function createBaseQueryMedianDeviations(): QueryMedianDeviations { return { denom: "" }; } e