= T extends T ? keyof T : never;
+export type Exact = P extends Builtin
+ ? P
+ : P & { [K in keyof P]: Exact
} & Record>, never>;
+
if (_m0.util.Long !== Long) {
_m0.util.Long = Long as any;
_m0.configure();
}
+
+function isSet(value: any): boolean {
+ return value !== null && value !== undefined;
+}
diff --git a/src/codec/confio/poe/v1beta1/query.ts b/src/codec/confio/poe/v1beta1/query.ts
index a63faf9e..0fb4b3a7 100644
--- a/src/codec/confio/poe/v1beta1/query.ts
+++ b/src/codec/confio/poe/v1beta1/query.ts
@@ -1,6 +1,6 @@
/* eslint-disable */
import Long from "long";
-import _m0 from "protobufjs/minimal";
+import * as _m0 from "protobufjs/minimal";
import {
PoEContractType,
poEContractTypeFromJSON,
@@ -109,7 +109,9 @@ export interface QueryValidatorOutstandingRewardResponse {
reward?: DecCoin;
}
-const baseQueryContractAddressRequest: object = { contractType: 0 };
+function createBaseQueryContractAddressRequest(): QueryContractAddressRequest {
+ return { contractType: 0 };
+}
export const QueryContractAddressRequest = {
encode(message: QueryContractAddressRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -122,7 +124,7 @@ export const QueryContractAddressRequest = {
decode(input: _m0.Reader | Uint8Array, length?: number): QueryContractAddressRequest {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseQueryContractAddressRequest } as QueryContractAddressRequest;
+ const message = createBaseQueryContractAddressRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -138,13 +140,9 @@ export const QueryContractAddressRequest = {
},
fromJSON(object: any): QueryContractAddressRequest {
- const message = { ...baseQueryContractAddressRequest } as QueryContractAddressRequest;
- if (object.contractType !== undefined && object.contractType !== null) {
- message.contractType = poEContractTypeFromJSON(object.contractType);
- } else {
- message.contractType = 0;
- }
- return message;
+ return {
+ contractType: isSet(object.contractType) ? poEContractTypeFromJSON(object.contractType) : 0,
+ };
},
toJSON(message: QueryContractAddressRequest): unknown {
@@ -153,14 +151,18 @@ export const QueryContractAddressRequest = {
return obj;
},
- fromPartial(object: DeepPartial): QueryContractAddressRequest {
- const message = { ...baseQueryContractAddressRequest } as QueryContractAddressRequest;
+ fromPartial, I>>(
+ object: I,
+ ): QueryContractAddressRequest {
+ const message = createBaseQueryContractAddressRequest();
message.contractType = object.contractType ?? 0;
return message;
},
};
-const baseQueryContractAddressResponse: object = { address: "" };
+function createBaseQueryContractAddressResponse(): QueryContractAddressResponse {
+ return { address: "" };
+}
export const QueryContractAddressResponse = {
encode(message: QueryContractAddressResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -173,7 +175,7 @@ export const QueryContractAddressResponse = {
decode(input: _m0.Reader | Uint8Array, length?: number): QueryContractAddressResponse {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseQueryContractAddressResponse } as QueryContractAddressResponse;
+ const message = createBaseQueryContractAddressResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -189,13 +191,9 @@ export const QueryContractAddressResponse = {
},
fromJSON(object: any): QueryContractAddressResponse {
- const message = { ...baseQueryContractAddressResponse } as QueryContractAddressResponse;
- if (object.address !== undefined && object.address !== null) {
- message.address = String(object.address);
- } else {
- message.address = "";
- }
- return message;
+ return {
+ address: isSet(object.address) ? String(object.address) : "",
+ };
},
toJSON(message: QueryContractAddressResponse): unknown {
@@ -204,14 +202,18 @@ export const QueryContractAddressResponse = {
return obj;
},
- fromPartial(object: DeepPartial): QueryContractAddressResponse {
- const message = { ...baseQueryContractAddressResponse } as QueryContractAddressResponse;
+ fromPartial, I>>(
+ object: I,
+ ): QueryContractAddressResponse {
+ const message = createBaseQueryContractAddressResponse();
message.address = object.address ?? "";
return message;
},
};
-const baseQueryUnbondingPeriodRequest: object = {};
+function createBaseQueryUnbondingPeriodRequest(): QueryUnbondingPeriodRequest {
+ return {};
+}
export const QueryUnbondingPeriodRequest = {
encode(_: QueryUnbondingPeriodRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -221,7 +223,7 @@ export const QueryUnbondingPeriodRequest = {
decode(input: _m0.Reader | Uint8Array, length?: number): QueryUnbondingPeriodRequest {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseQueryUnbondingPeriodRequest } as QueryUnbondingPeriodRequest;
+ const message = createBaseQueryUnbondingPeriodRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -234,8 +236,7 @@ export const QueryUnbondingPeriodRequest = {
},
fromJSON(_: any): QueryUnbondingPeriodRequest {
- const message = { ...baseQueryUnbondingPeriodRequest } as QueryUnbondingPeriodRequest;
- return message;
+ return {};
},
toJSON(_: QueryUnbondingPeriodRequest): unknown {
@@ -243,13 +244,17 @@ export const QueryUnbondingPeriodRequest = {
return obj;
},
- fromPartial(_: DeepPartial): QueryUnbondingPeriodRequest {
- const message = { ...baseQueryUnbondingPeriodRequest } as QueryUnbondingPeriodRequest;
+ fromPartial, I>>(
+ _: I,
+ ): QueryUnbondingPeriodRequest {
+ const message = createBaseQueryUnbondingPeriodRequest();
return message;
},
};
-const baseQueryUnbondingPeriodResponse: object = {};
+function createBaseQueryUnbondingPeriodResponse(): QueryUnbondingPeriodResponse {
+ return { time: undefined };
+}
export const QueryUnbondingPeriodResponse = {
encode(message: QueryUnbondingPeriodResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -262,7 +267,7 @@ export const QueryUnbondingPeriodResponse = {
decode(input: _m0.Reader | Uint8Array, length?: number): QueryUnbondingPeriodResponse {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseQueryUnbondingPeriodResponse } as QueryUnbondingPeriodResponse;
+ const message = createBaseQueryUnbondingPeriodResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -278,13 +283,9 @@ export const QueryUnbondingPeriodResponse = {
},
fromJSON(object: any): QueryUnbondingPeriodResponse {
- const message = { ...baseQueryUnbondingPeriodResponse } as QueryUnbondingPeriodResponse;
- if (object.time !== undefined && object.time !== null) {
- message.time = Duration.fromJSON(object.time);
- } else {
- message.time = undefined;
- }
- return message;
+ return {
+ time: isSet(object.time) ? Duration.fromJSON(object.time) : undefined,
+ };
},
toJSON(message: QueryUnbondingPeriodResponse): unknown {
@@ -293,18 +294,19 @@ export const QueryUnbondingPeriodResponse = {
return obj;
},
- fromPartial(object: DeepPartial): QueryUnbondingPeriodResponse {
- const message = { ...baseQueryUnbondingPeriodResponse } as QueryUnbondingPeriodResponse;
- if (object.time !== undefined && object.time !== null) {
- message.time = Duration.fromPartial(object.time);
- } else {
- message.time = undefined;
- }
+ fromPartial, I>>(
+ object: I,
+ ): QueryUnbondingPeriodResponse {
+ const message = createBaseQueryUnbondingPeriodResponse();
+ message.time =
+ object.time !== undefined && object.time !== null ? Duration.fromPartial(object.time) : undefined;
return message;
},
};
-const baseQueryValidatorDelegationRequest: object = { validatorAddr: "" };
+function createBaseQueryValidatorDelegationRequest(): QueryValidatorDelegationRequest {
+ return { validatorAddr: "" };
+}
export const QueryValidatorDelegationRequest = {
encode(message: QueryValidatorDelegationRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -317,7 +319,7 @@ export const QueryValidatorDelegationRequest = {
decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDelegationRequest {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseQueryValidatorDelegationRequest } as QueryValidatorDelegationRequest;
+ const message = createBaseQueryValidatorDelegationRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -333,13 +335,9 @@ export const QueryValidatorDelegationRequest = {
},
fromJSON(object: any): QueryValidatorDelegationRequest {
- const message = { ...baseQueryValidatorDelegationRequest } as QueryValidatorDelegationRequest;
- if (object.validatorAddr !== undefined && object.validatorAddr !== null) {
- message.validatorAddr = String(object.validatorAddr);
- } else {
- message.validatorAddr = "";
- }
- return message;
+ return {
+ validatorAddr: isSet(object.validatorAddr) ? String(object.validatorAddr) : "",
+ };
},
toJSON(message: QueryValidatorDelegationRequest): unknown {
@@ -348,14 +346,18 @@ export const QueryValidatorDelegationRequest = {
return obj;
},
- fromPartial(object: DeepPartial): QueryValidatorDelegationRequest {
- const message = { ...baseQueryValidatorDelegationRequest } as QueryValidatorDelegationRequest;
+ fromPartial, I>>(
+ object: I,
+ ): QueryValidatorDelegationRequest {
+ const message = createBaseQueryValidatorDelegationRequest();
message.validatorAddr = object.validatorAddr ?? "";
return message;
},
};
-const baseQueryValidatorDelegationResponse: object = {};
+function createBaseQueryValidatorDelegationResponse(): QueryValidatorDelegationResponse {
+ return { balance: undefined };
+}
export const QueryValidatorDelegationResponse = {
encode(message: QueryValidatorDelegationResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -368,7 +370,7 @@ export const QueryValidatorDelegationResponse = {
decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDelegationResponse {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseQueryValidatorDelegationResponse } as QueryValidatorDelegationResponse;
+ const message = createBaseQueryValidatorDelegationResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -384,13 +386,9 @@ export const QueryValidatorDelegationResponse = {
},
fromJSON(object: any): QueryValidatorDelegationResponse {
- const message = { ...baseQueryValidatorDelegationResponse } as QueryValidatorDelegationResponse;
- if (object.balance !== undefined && object.balance !== null) {
- message.balance = Coin.fromJSON(object.balance);
- } else {
- message.balance = undefined;
- }
- return message;
+ return {
+ balance: isSet(object.balance) ? Coin.fromJSON(object.balance) : undefined,
+ };
},
toJSON(message: QueryValidatorDelegationResponse): unknown {
@@ -400,18 +398,19 @@ export const QueryValidatorDelegationResponse = {
return obj;
},
- fromPartial(object: DeepPartial): QueryValidatorDelegationResponse {
- const message = { ...baseQueryValidatorDelegationResponse } as QueryValidatorDelegationResponse;
- if (object.balance !== undefined && object.balance !== null) {
- message.balance = Coin.fromPartial(object.balance);
- } else {
- message.balance = undefined;
- }
+ fromPartial, I>>(
+ object: I,
+ ): QueryValidatorDelegationResponse {
+ const message = createBaseQueryValidatorDelegationResponse();
+ message.balance =
+ object.balance !== undefined && object.balance !== null ? Coin.fromPartial(object.balance) : undefined;
return message;
},
};
-const baseQueryValidatorUnbondingDelegationsRequest: object = { validatorAddr: "" };
+function createBaseQueryValidatorUnbondingDelegationsRequest(): QueryValidatorUnbondingDelegationsRequest {
+ return { validatorAddr: "", pagination: undefined };
+}
export const QueryValidatorUnbondingDelegationsRequest = {
encode(
@@ -430,9 +429,7 @@ export const QueryValidatorUnbondingDelegationsRequest = {
decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorUnbondingDelegationsRequest {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = {
- ...baseQueryValidatorUnbondingDelegationsRequest,
- } as QueryValidatorUnbondingDelegationsRequest;
+ const message = createBaseQueryValidatorUnbondingDelegationsRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -451,20 +448,10 @@ export const QueryValidatorUnbondingDelegationsRequest = {
},
fromJSON(object: any): QueryValidatorUnbondingDelegationsRequest {
- const message = {
- ...baseQueryValidatorUnbondingDelegationsRequest,
- } as QueryValidatorUnbondingDelegationsRequest;
- if (object.validatorAddr !== undefined && object.validatorAddr !== null) {
- message.validatorAddr = String(object.validatorAddr);
- } else {
- message.validatorAddr = "";
- }
- if (object.pagination !== undefined && object.pagination !== null) {
- message.pagination = PageRequest.fromJSON(object.pagination);
- } else {
- message.pagination = undefined;
- }
- return message;
+ return {
+ validatorAddr: isSet(object.validatorAddr) ? String(object.validatorAddr) : "",
+ pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined,
+ };
},
toJSON(message: QueryValidatorUnbondingDelegationsRequest): unknown {
@@ -475,23 +462,22 @@ export const QueryValidatorUnbondingDelegationsRequest = {
return obj;
},
- fromPartial(
- object: DeepPartial,
+ fromPartial, I>>(
+ object: I,
): QueryValidatorUnbondingDelegationsRequest {
- const message = {
- ...baseQueryValidatorUnbondingDelegationsRequest,
- } as QueryValidatorUnbondingDelegationsRequest;
+ const message = createBaseQueryValidatorUnbondingDelegationsRequest();
message.validatorAddr = object.validatorAddr ?? "";
- if (object.pagination !== undefined && object.pagination !== null) {
- message.pagination = PageRequest.fromPartial(object.pagination);
- } else {
- message.pagination = undefined;
- }
+ message.pagination =
+ object.pagination !== undefined && object.pagination !== null
+ ? PageRequest.fromPartial(object.pagination)
+ : undefined;
return message;
},
};
-const baseQueryValidatorUnbondingDelegationsResponse: object = {};
+function createBaseQueryValidatorUnbondingDelegationsResponse(): QueryValidatorUnbondingDelegationsResponse {
+ return { entries: [], pagination: undefined };
+}
export const QueryValidatorUnbondingDelegationsResponse = {
encode(
@@ -510,10 +496,7 @@ export const QueryValidatorUnbondingDelegationsResponse = {
decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorUnbondingDelegationsResponse {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = {
- ...baseQueryValidatorUnbondingDelegationsResponse,
- } as QueryValidatorUnbondingDelegationsResponse;
- message.entries = [];
+ const message = createBaseQueryValidatorUnbondingDelegationsResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -532,21 +515,12 @@ export const QueryValidatorUnbondingDelegationsResponse = {
},
fromJSON(object: any): QueryValidatorUnbondingDelegationsResponse {
- const message = {
- ...baseQueryValidatorUnbondingDelegationsResponse,
- } as QueryValidatorUnbondingDelegationsResponse;
- message.entries = [];
- if (object.entries !== undefined && object.entries !== null) {
- for (const e of object.entries) {
- message.entries.push(UnbondingDelegationEntry.fromJSON(e));
- }
- }
- if (object.pagination !== undefined && object.pagination !== null) {
- message.pagination = PageResponse.fromJSON(object.pagination);
- } else {
- message.pagination = undefined;
- }
- return message;
+ return {
+ entries: Array.isArray(object?.entries)
+ ? object.entries.map((e: any) => UnbondingDelegationEntry.fromJSON(e))
+ : [],
+ pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined,
+ };
},
toJSON(message: QueryValidatorUnbondingDelegationsResponse): unknown {
@@ -561,28 +535,22 @@ export const QueryValidatorUnbondingDelegationsResponse = {
return obj;
},
- fromPartial(
- object: DeepPartial,
+ fromPartial, I>>(
+ object: I,
): QueryValidatorUnbondingDelegationsResponse {
- const message = {
- ...baseQueryValidatorUnbondingDelegationsResponse,
- } as QueryValidatorUnbondingDelegationsResponse;
- message.entries = [];
- if (object.entries !== undefined && object.entries !== null) {
- for (const e of object.entries) {
- message.entries.push(UnbondingDelegationEntry.fromPartial(e));
- }
- }
- if (object.pagination !== undefined && object.pagination !== null) {
- message.pagination = PageResponse.fromPartial(object.pagination);
- } else {
- message.pagination = undefined;
- }
+ const message = createBaseQueryValidatorUnbondingDelegationsResponse();
+ message.entries = object.entries?.map((e) => UnbondingDelegationEntry.fromPartial(e)) || [];
+ message.pagination =
+ object.pagination !== undefined && object.pagination !== null
+ ? PageResponse.fromPartial(object.pagination)
+ : undefined;
return message;
},
};
-const baseQueryValidatorOutstandingRewardRequest: object = { validatorAddress: "" };
+function createBaseQueryValidatorOutstandingRewardRequest(): QueryValidatorOutstandingRewardRequest {
+ return { validatorAddress: "" };
+}
export const QueryValidatorOutstandingRewardRequest = {
encode(
@@ -598,9 +566,7 @@ export const QueryValidatorOutstandingRewardRequest = {
decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorOutstandingRewardRequest {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = {
- ...baseQueryValidatorOutstandingRewardRequest,
- } as QueryValidatorOutstandingRewardRequest;
+ const message = createBaseQueryValidatorOutstandingRewardRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -616,15 +582,9 @@ export const QueryValidatorOutstandingRewardRequest = {
},
fromJSON(object: any): QueryValidatorOutstandingRewardRequest {
- const message = {
- ...baseQueryValidatorOutstandingRewardRequest,
- } as QueryValidatorOutstandingRewardRequest;
- if (object.validatorAddress !== undefined && object.validatorAddress !== null) {
- message.validatorAddress = String(object.validatorAddress);
- } else {
- message.validatorAddress = "";
- }
- return message;
+ return {
+ validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "",
+ };
},
toJSON(message: QueryValidatorOutstandingRewardRequest): unknown {
@@ -633,18 +593,18 @@ export const QueryValidatorOutstandingRewardRequest = {
return obj;
},
- fromPartial(
- object: DeepPartial,
+ fromPartial, I>>(
+ object: I,
): QueryValidatorOutstandingRewardRequest {
- const message = {
- ...baseQueryValidatorOutstandingRewardRequest,
- } as QueryValidatorOutstandingRewardRequest;
+ const message = createBaseQueryValidatorOutstandingRewardRequest();
message.validatorAddress = object.validatorAddress ?? "";
return message;
},
};
-const baseQueryValidatorOutstandingRewardResponse: object = {};
+function createBaseQueryValidatorOutstandingRewardResponse(): QueryValidatorOutstandingRewardResponse {
+ return { reward: undefined };
+}
export const QueryValidatorOutstandingRewardResponse = {
encode(
@@ -660,9 +620,7 @@ export const QueryValidatorOutstandingRewardResponse = {
decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorOutstandingRewardResponse {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = {
- ...baseQueryValidatorOutstandingRewardResponse,
- } as QueryValidatorOutstandingRewardResponse;
+ const message = createBaseQueryValidatorOutstandingRewardResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -678,15 +636,9 @@ export const QueryValidatorOutstandingRewardResponse = {
},
fromJSON(object: any): QueryValidatorOutstandingRewardResponse {
- const message = {
- ...baseQueryValidatorOutstandingRewardResponse,
- } as QueryValidatorOutstandingRewardResponse;
- if (object.reward !== undefined && object.reward !== null) {
- message.reward = DecCoin.fromJSON(object.reward);
- } else {
- message.reward = undefined;
- }
- return message;
+ return {
+ reward: isSet(object.reward) ? DecCoin.fromJSON(object.reward) : undefined,
+ };
},
toJSON(message: QueryValidatorOutstandingRewardResponse): unknown {
@@ -696,17 +648,12 @@ export const QueryValidatorOutstandingRewardResponse = {
return obj;
},
- fromPartial(
- object: DeepPartial,
+ fromPartial, I>>(
+ object: I,
): QueryValidatorOutstandingRewardResponse {
- const message = {
- ...baseQueryValidatorOutstandingRewardResponse,
- } as QueryValidatorOutstandingRewardResponse;
- if (object.reward !== undefined && object.reward !== null) {
- message.reward = DecCoin.fromPartial(object.reward);
- } else {
- message.reward = undefined;
- }
+ const message = createBaseQueryValidatorOutstandingRewardResponse();
+ message.reward =
+ object.reward !== undefined && object.reward !== null ? DecCoin.fromPartial(object.reward) : undefined;
return message;
},
};
@@ -805,9 +752,12 @@ interface Rpc {
request(service: string, method: string, data: Uint8Array): Promise;
}
-type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined | Long;
+type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
+
export type DeepPartial = T extends Builtin
? T
+ : T extends Long
+ ? string | number | Long
: T extends Array
? Array>
: T extends ReadonlyArray
@@ -816,7 +766,16 @@ export type DeepPartial = T extends Builtin
? { [K in keyof T]?: DeepPartial }
: Partial;
+type KeysOfUnion = T extends T ? keyof T : never;
+export type Exact = P extends Builtin
+ ? P
+ : P & { [K in keyof P]: Exact
} & Record>, never>;
+
if (_m0.util.Long !== Long) {
_m0.util.Long = Long as any;
_m0.configure();
}
+
+function isSet(value: any): boolean {
+ return value !== null && value !== undefined;
+}
diff --git a/src/codec/cosmos/base/query/v1beta1/pagination.ts b/src/codec/cosmos/base/query/v1beta1/pagination.ts
index 65a6fcdd..db06d01c 100644
--- a/src/codec/cosmos/base/query/v1beta1/pagination.ts
+++ b/src/codec/cosmos/base/query/v1beta1/pagination.ts
@@ -1,6 +1,6 @@
/* eslint-disable */
import Long from "long";
-import _m0 from "protobufjs/minimal";
+import * as _m0 from "protobufjs/minimal";
export const protobufPackage = "cosmos.base.query.v1beta1";
@@ -38,6 +38,12 @@ export interface PageRequest {
* is set.
*/
countTotal: boolean;
+ /**
+ * reverse is set to true if results are to be returned in the descending order.
+ *
+ * Since: cosmos-sdk 0.43
+ */
+ reverse: boolean;
}
/**
@@ -62,7 +68,9 @@ export interface PageResponse {
total: Long;
}
-const basePageRequest: object = { offset: Long.UZERO, limit: Long.UZERO, countTotal: false };
+function createBasePageRequest(): PageRequest {
+ return { key: new Uint8Array(), offset: Long.UZERO, limit: Long.UZERO, countTotal: false, reverse: false };
+}
export const PageRequest = {
encode(message: PageRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -78,14 +86,16 @@ export const PageRequest = {
if (message.countTotal === true) {
writer.uint32(32).bool(message.countTotal);
}
+ if (message.reverse === true) {
+ writer.uint32(40).bool(message.reverse);
+ }
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): PageRequest {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...basePageRequest } as PageRequest;
- message.key = new Uint8Array();
+ const message = createBasePageRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -101,6 +111,9 @@ export const PageRequest = {
case 4:
message.countTotal = reader.bool();
break;
+ case 5:
+ message.reverse = reader.bool();
+ break;
default:
reader.skipType(tag & 7);
break;
@@ -110,27 +123,13 @@ export const PageRequest = {
},
fromJSON(object: any): PageRequest {
- const message = { ...basePageRequest } as PageRequest;
- message.key = new Uint8Array();
- if (object.key !== undefined && object.key !== null) {
- message.key = bytesFromBase64(object.key);
- }
- if (object.offset !== undefined && object.offset !== null) {
- message.offset = Long.fromString(object.offset);
- } else {
- message.offset = Long.UZERO;
- }
- if (object.limit !== undefined && object.limit !== null) {
- message.limit = Long.fromString(object.limit);
- } else {
- message.limit = Long.UZERO;
- }
- if (object.countTotal !== undefined && object.countTotal !== null) {
- message.countTotal = Boolean(object.countTotal);
- } else {
- message.countTotal = false;
- }
- return message;
+ return {
+ key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(),
+ offset: isSet(object.offset) ? Long.fromString(object.offset) : Long.UZERO,
+ limit: isSet(object.limit) ? Long.fromString(object.limit) : Long.UZERO,
+ countTotal: isSet(object.countTotal) ? Boolean(object.countTotal) : false,
+ reverse: isSet(object.reverse) ? Boolean(object.reverse) : false,
+ };
},
toJSON(message: PageRequest): unknown {
@@ -140,28 +139,26 @@ export const PageRequest = {
message.offset !== undefined && (obj.offset = (message.offset || Long.UZERO).toString());
message.limit !== undefined && (obj.limit = (message.limit || Long.UZERO).toString());
message.countTotal !== undefined && (obj.countTotal = message.countTotal);
+ message.reverse !== undefined && (obj.reverse = message.reverse);
return obj;
},
- fromPartial(object: DeepPartial): PageRequest {
- const message = { ...basePageRequest } as PageRequest;
+ fromPartial, I>>(object: I): PageRequest {
+ const message = createBasePageRequest();
message.key = object.key ?? new Uint8Array();
- if (object.offset !== undefined && object.offset !== null) {
- message.offset = object.offset as Long;
- } else {
- message.offset = Long.UZERO;
- }
- if (object.limit !== undefined && object.limit !== null) {
- message.limit = object.limit as Long;
- } else {
- message.limit = Long.UZERO;
- }
+ message.offset =
+ object.offset !== undefined && object.offset !== null ? Long.fromValue(object.offset) : Long.UZERO;
+ message.limit =
+ object.limit !== undefined && object.limit !== null ? Long.fromValue(object.limit) : Long.UZERO;
message.countTotal = object.countTotal ?? false;
+ message.reverse = object.reverse ?? false;
return message;
},
};
-const basePageResponse: object = { total: Long.UZERO };
+function createBasePageResponse(): PageResponse {
+ return { nextKey: new Uint8Array(), total: Long.UZERO };
+}
export const PageResponse = {
encode(message: PageResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -177,8 +174,7 @@ export const PageResponse = {
decode(input: _m0.Reader | Uint8Array, length?: number): PageResponse {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...basePageResponse } as PageResponse;
- message.nextKey = new Uint8Array();
+ const message = createBasePageResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -197,17 +193,10 @@ export const PageResponse = {
},
fromJSON(object: any): PageResponse {
- const message = { ...basePageResponse } as PageResponse;
- message.nextKey = new Uint8Array();
- if (object.nextKey !== undefined && object.nextKey !== null) {
- message.nextKey = bytesFromBase64(object.nextKey);
- }
- if (object.total !== undefined && object.total !== null) {
- message.total = Long.fromString(object.total);
- } else {
- message.total = Long.UZERO;
- }
- return message;
+ return {
+ nextKey: isSet(object.nextKey) ? bytesFromBase64(object.nextKey) : new Uint8Array(),
+ total: isSet(object.total) ? Long.fromString(object.total) : Long.UZERO,
+ };
},
toJSON(message: PageResponse): unknown {
@@ -218,14 +207,11 @@ export const PageResponse = {
return obj;
},
- fromPartial(object: DeepPartial): PageResponse {
- const message = { ...basePageResponse } as PageResponse;
+ fromPartial, I>>(object: I): PageResponse {
+ const message = createBasePageResponse();
message.nextKey = object.nextKey ?? new Uint8Array();
- if (object.total !== undefined && object.total !== null) {
- message.total = object.total as Long;
- } else {
- message.total = Long.UZERO;
- }
+ message.total =
+ object.total !== undefined && object.total !== null ? Long.fromValue(object.total) : Long.UZERO;
return message;
},
};
@@ -256,15 +242,18 @@ const btoa: (bin: string) => string =
globalThis.btoa || ((bin) => globalThis.Buffer.from(bin, "binary").toString("base64"));
function base64FromBytes(arr: Uint8Array): string {
const bin: string[] = [];
- for (const byte of arr) {
+ arr.forEach((byte) => {
bin.push(String.fromCharCode(byte));
- }
+ });
return btoa(bin.join(""));
}
-type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined | Long;
+type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
+
export type DeepPartial = T extends Builtin
? T
+ : T extends Long
+ ? string | number | Long
: T extends Array
? Array>
: T extends ReadonlyArray
@@ -273,7 +262,16 @@ export type DeepPartial = T extends Builtin
? { [K in keyof T]?: DeepPartial }
: Partial;
+type KeysOfUnion = T extends T ? keyof T : never;
+export type Exact = P extends Builtin
+ ? P
+ : P & { [K in keyof P]: Exact
} & Record>, never>;
+
if (_m0.util.Long !== Long) {
_m0.util.Long = Long as any;
_m0.configure();
}
+
+function isSet(value: any): boolean {
+ return value !== null && value !== undefined;
+}
diff --git a/src/codec/cosmos/base/v1beta1/coin.ts b/src/codec/cosmos/base/v1beta1/coin.ts
index c9ee32f6..6eb6476c 100644
--- a/src/codec/cosmos/base/v1beta1/coin.ts
+++ b/src/codec/cosmos/base/v1beta1/coin.ts
@@ -1,6 +1,6 @@
/* eslint-disable */
import Long from "long";
-import _m0 from "protobufjs/minimal";
+import * as _m0 from "protobufjs/minimal";
export const protobufPackage = "cosmos.base.v1beta1";
@@ -36,7 +36,9 @@ export interface DecProto {
dec: string;
}
-const baseCoin: object = { denom: "", amount: "" };
+function createBaseCoin(): Coin {
+ return { denom: "", amount: "" };
+}
export const Coin = {
encode(message: Coin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -52,7 +54,7 @@ export const Coin = {
decode(input: _m0.Reader | Uint8Array, length?: number): Coin {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseCoin } as Coin;
+ const message = createBaseCoin();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -71,18 +73,10 @@ export const Coin = {
},
fromJSON(object: any): Coin {
- const message = { ...baseCoin } as Coin;
- if (object.denom !== undefined && object.denom !== null) {
- message.denom = String(object.denom);
- } else {
- message.denom = "";
- }
- if (object.amount !== undefined && object.amount !== null) {
- message.amount = String(object.amount);
- } else {
- message.amount = "";
- }
- return message;
+ return {
+ denom: isSet(object.denom) ? String(object.denom) : "",
+ amount: isSet(object.amount) ? String(object.amount) : "",
+ };
},
toJSON(message: Coin): unknown {
@@ -92,15 +86,17 @@ export const Coin = {
return obj;
},
- fromPartial(object: DeepPartial): Coin {
- const message = { ...baseCoin } as Coin;
+ fromPartial, I>>(object: I): Coin {
+ const message = createBaseCoin();
message.denom = object.denom ?? "";
message.amount = object.amount ?? "";
return message;
},
};
-const baseDecCoin: object = { denom: "", amount: "" };
+function createBaseDecCoin(): DecCoin {
+ return { denom: "", amount: "" };
+}
export const DecCoin = {
encode(message: DecCoin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -116,7 +112,7 @@ export const DecCoin = {
decode(input: _m0.Reader | Uint8Array, length?: number): DecCoin {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseDecCoin } as DecCoin;
+ const message = createBaseDecCoin();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -135,18 +131,10 @@ export const DecCoin = {
},
fromJSON(object: any): DecCoin {
- const message = { ...baseDecCoin } as DecCoin;
- if (object.denom !== undefined && object.denom !== null) {
- message.denom = String(object.denom);
- } else {
- message.denom = "";
- }
- if (object.amount !== undefined && object.amount !== null) {
- message.amount = String(object.amount);
- } else {
- message.amount = "";
- }
- return message;
+ return {
+ denom: isSet(object.denom) ? String(object.denom) : "",
+ amount: isSet(object.amount) ? String(object.amount) : "",
+ };
},
toJSON(message: DecCoin): unknown {
@@ -156,15 +144,17 @@ export const DecCoin = {
return obj;
},
- fromPartial(object: DeepPartial): DecCoin {
- const message = { ...baseDecCoin } as DecCoin;
+ fromPartial, I>>(object: I): DecCoin {
+ const message = createBaseDecCoin();
message.denom = object.denom ?? "";
message.amount = object.amount ?? "";
return message;
},
};
-const baseIntProto: object = { int: "" };
+function createBaseIntProto(): IntProto {
+ return { int: "" };
+}
export const IntProto = {
encode(message: IntProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -177,7 +167,7 @@ export const IntProto = {
decode(input: _m0.Reader | Uint8Array, length?: number): IntProto {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseIntProto } as IntProto;
+ const message = createBaseIntProto();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -193,13 +183,9 @@ export const IntProto = {
},
fromJSON(object: any): IntProto {
- const message = { ...baseIntProto } as IntProto;
- if (object.int !== undefined && object.int !== null) {
- message.int = String(object.int);
- } else {
- message.int = "";
- }
- return message;
+ return {
+ int: isSet(object.int) ? String(object.int) : "",
+ };
},
toJSON(message: IntProto): unknown {
@@ -208,14 +194,16 @@ export const IntProto = {
return obj;
},
- fromPartial(object: DeepPartial): IntProto {
- const message = { ...baseIntProto } as IntProto;
+ fromPartial, I>>(object: I): IntProto {
+ const message = createBaseIntProto();
message.int = object.int ?? "";
return message;
},
};
-const baseDecProto: object = { dec: "" };
+function createBaseDecProto(): DecProto {
+ return { dec: "" };
+}
export const DecProto = {
encode(message: DecProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -228,7 +216,7 @@ export const DecProto = {
decode(input: _m0.Reader | Uint8Array, length?: number): DecProto {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseDecProto } as DecProto;
+ const message = createBaseDecProto();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -244,13 +232,9 @@ export const DecProto = {
},
fromJSON(object: any): DecProto {
- const message = { ...baseDecProto } as DecProto;
- if (object.dec !== undefined && object.dec !== null) {
- message.dec = String(object.dec);
- } else {
- message.dec = "";
- }
- return message;
+ return {
+ dec: isSet(object.dec) ? String(object.dec) : "",
+ };
},
toJSON(message: DecProto): unknown {
@@ -259,16 +243,19 @@ export const DecProto = {
return obj;
},
- fromPartial(object: DeepPartial): DecProto {
- const message = { ...baseDecProto } as DecProto;
+ fromPartial, I>>(object: I): DecProto {
+ const message = createBaseDecProto();
message.dec = object.dec ?? "";
return message;
},
};
-type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined | Long;
+type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
+
export type DeepPartial = T extends Builtin
? T
+ : T extends Long
+ ? string | number | Long
: T extends Array
? Array>
: T extends ReadonlyArray
@@ -277,7 +264,16 @@ export type DeepPartial = T extends Builtin
? { [K in keyof T]?: DeepPartial }
: Partial;
+type KeysOfUnion = T extends T ? keyof T : never;
+export type Exact = P extends Builtin
+ ? P
+ : P & { [K in keyof P]: Exact
} & Record>, never>;
+
if (_m0.util.Long !== Long) {
_m0.util.Long = Long as any;
_m0.configure();
}
+
+function isSet(value: any): boolean {
+ return value !== null && value !== undefined;
+}
diff --git a/src/codec/cosmos/staking/v1beta1/query.ts b/src/codec/cosmos/staking/v1beta1/query.ts
index ed91a492..95e750cc 100644
--- a/src/codec/cosmos/staking/v1beta1/query.ts
+++ b/src/codec/cosmos/staking/v1beta1/query.ts
@@ -1,6 +1,6 @@
/* eslint-disable */
import Long from "long";
-import _m0 from "protobufjs/minimal";
+import * as _m0 from "protobufjs/minimal";
import { PageRequest, PageResponse } from "../../../cosmos/base/query/v1beta1/pagination";
import {
Validator,
@@ -264,7 +264,9 @@ export interface QueryParamsResponse {
params?: Params;
}
-const baseQueryValidatorsRequest: object = { status: "" };
+function createBaseQueryValidatorsRequest(): QueryValidatorsRequest {
+ return { status: "", pagination: undefined };
+}
export const QueryValidatorsRequest = {
encode(message: QueryValidatorsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -280,7 +282,7 @@ export const QueryValidatorsRequest = {
decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorsRequest {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseQueryValidatorsRequest } as QueryValidatorsRequest;
+ const message = createBaseQueryValidatorsRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -299,18 +301,10 @@ export const QueryValidatorsRequest = {
},
fromJSON(object: any): QueryValidatorsRequest {
- const message = { ...baseQueryValidatorsRequest } as QueryValidatorsRequest;
- if (object.status !== undefined && object.status !== null) {
- message.status = String(object.status);
- } else {
- message.status = "";
- }
- if (object.pagination !== undefined && object.pagination !== null) {
- message.pagination = PageRequest.fromJSON(object.pagination);
- } else {
- message.pagination = undefined;
- }
- return message;
+ return {
+ status: isSet(object.status) ? String(object.status) : "",
+ pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined,
+ };
},
toJSON(message: QueryValidatorsRequest): unknown {
@@ -321,19 +315,20 @@ export const QueryValidatorsRequest = {
return obj;
},
- fromPartial(object: DeepPartial): QueryValidatorsRequest {
- const message = { ...baseQueryValidatorsRequest } as QueryValidatorsRequest;
+ fromPartial, I>>(object: I): QueryValidatorsRequest {
+ const message = createBaseQueryValidatorsRequest();
message.status = object.status ?? "";
- if (object.pagination !== undefined && object.pagination !== null) {
- message.pagination = PageRequest.fromPartial(object.pagination);
- } else {
- message.pagination = undefined;
- }
+ message.pagination =
+ object.pagination !== undefined && object.pagination !== null
+ ? PageRequest.fromPartial(object.pagination)
+ : undefined;
return message;
},
};
-const baseQueryValidatorsResponse: object = {};
+function createBaseQueryValidatorsResponse(): QueryValidatorsResponse {
+ return { validators: [], pagination: undefined };
+}
export const QueryValidatorsResponse = {
encode(message: QueryValidatorsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -349,8 +344,7 @@ export const QueryValidatorsResponse = {
decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorsResponse {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseQueryValidatorsResponse } as QueryValidatorsResponse;
- message.validators = [];
+ const message = createBaseQueryValidatorsResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -369,19 +363,12 @@ export const QueryValidatorsResponse = {
},
fromJSON(object: any): QueryValidatorsResponse {
- const message = { ...baseQueryValidatorsResponse } as QueryValidatorsResponse;
- message.validators = [];
- if (object.validators !== undefined && object.validators !== null) {
- for (const e of object.validators) {
- message.validators.push(Validator.fromJSON(e));
- }
- }
- if (object.pagination !== undefined && object.pagination !== null) {
- message.pagination = PageResponse.fromJSON(object.pagination);
- } else {
- message.pagination = undefined;
- }
- return message;
+ return {
+ validators: Array.isArray(object?.validators)
+ ? object.validators.map((e: any) => Validator.fromJSON(e))
+ : [],
+ pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined,
+ };
},
toJSON(message: QueryValidatorsResponse): unknown {
@@ -396,24 +383,20 @@ export const QueryValidatorsResponse = {
return obj;
},
- fromPartial(object: DeepPartial): QueryValidatorsResponse {
- const message = { ...baseQueryValidatorsResponse } as QueryValidatorsResponse;
- message.validators = [];
- if (object.validators !== undefined && object.validators !== null) {
- for (const e of object.validators) {
- message.validators.push(Validator.fromPartial(e));
- }
- }
- if (object.pagination !== undefined && object.pagination !== null) {
- message.pagination = PageResponse.fromPartial(object.pagination);
- } else {
- message.pagination = undefined;
- }
+ fromPartial, I>>(object: I): QueryValidatorsResponse {
+ const message = createBaseQueryValidatorsResponse();
+ message.validators = object.validators?.map((e) => Validator.fromPartial(e)) || [];
+ message.pagination =
+ object.pagination !== undefined && object.pagination !== null
+ ? PageResponse.fromPartial(object.pagination)
+ : undefined;
return message;
},
};
-const baseQueryValidatorRequest: object = { validatorAddr: "" };
+function createBaseQueryValidatorRequest(): QueryValidatorRequest {
+ return { validatorAddr: "" };
+}
export const QueryValidatorRequest = {
encode(message: QueryValidatorRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -426,7 +409,7 @@ export const QueryValidatorRequest = {
decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorRequest {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseQueryValidatorRequest } as QueryValidatorRequest;
+ const message = createBaseQueryValidatorRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -442,13 +425,9 @@ export const QueryValidatorRequest = {
},
fromJSON(object: any): QueryValidatorRequest {
- const message = { ...baseQueryValidatorRequest } as QueryValidatorRequest;
- if (object.validatorAddr !== undefined && object.validatorAddr !== null) {
- message.validatorAddr = String(object.validatorAddr);
- } else {
- message.validatorAddr = "";
- }
- return message;
+ return {
+ validatorAddr: isSet(object.validatorAddr) ? String(object.validatorAddr) : "",
+ };
},
toJSON(message: QueryValidatorRequest): unknown {
@@ -457,14 +436,16 @@ export const QueryValidatorRequest = {
return obj;
},
- fromPartial(object: DeepPartial): QueryValidatorRequest {
- const message = { ...baseQueryValidatorRequest } as QueryValidatorRequest;
+ fromPartial, I>>(object: I): QueryValidatorRequest {
+ const message = createBaseQueryValidatorRequest();
message.validatorAddr = object.validatorAddr ?? "";
return message;
},
};
-const baseQueryValidatorResponse: object = {};
+function createBaseQueryValidatorResponse(): QueryValidatorResponse {
+ return { validator: undefined };
+}
export const QueryValidatorResponse = {
encode(message: QueryValidatorResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -477,7 +458,7 @@ export const QueryValidatorResponse = {
decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorResponse {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseQueryValidatorResponse } as QueryValidatorResponse;
+ const message = createBaseQueryValidatorResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -493,13 +474,9 @@ export const QueryValidatorResponse = {
},
fromJSON(object: any): QueryValidatorResponse {
- const message = { ...baseQueryValidatorResponse } as QueryValidatorResponse;
- if (object.validator !== undefined && object.validator !== null) {
- message.validator = Validator.fromJSON(object.validator);
- } else {
- message.validator = undefined;
- }
- return message;
+ return {
+ validator: isSet(object.validator) ? Validator.fromJSON(object.validator) : undefined,
+ };
},
toJSON(message: QueryValidatorResponse): unknown {
@@ -509,18 +486,19 @@ export const QueryValidatorResponse = {
return obj;
},
- fromPartial(object: DeepPartial): QueryValidatorResponse {
- const message = { ...baseQueryValidatorResponse } as QueryValidatorResponse;
- if (object.validator !== undefined && object.validator !== null) {
- message.validator = Validator.fromPartial(object.validator);
- } else {
- message.validator = undefined;
- }
+ fromPartial, I>>(object: I): QueryValidatorResponse {
+ const message = createBaseQueryValidatorResponse();
+ message.validator =
+ object.validator !== undefined && object.validator !== null
+ ? Validator.fromPartial(object.validator)
+ : undefined;
return message;
},
};
-const baseQueryValidatorDelegationsRequest: object = { validatorAddr: "" };
+function createBaseQueryValidatorDelegationsRequest(): QueryValidatorDelegationsRequest {
+ return { validatorAddr: "", pagination: undefined };
+}
export const QueryValidatorDelegationsRequest = {
encode(message: QueryValidatorDelegationsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -536,7 +514,7 @@ export const QueryValidatorDelegationsRequest = {
decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDelegationsRequest {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseQueryValidatorDelegationsRequest } as QueryValidatorDelegationsRequest;
+ const message = createBaseQueryValidatorDelegationsRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -555,18 +533,10 @@ export const QueryValidatorDelegationsRequest = {
},
fromJSON(object: any): QueryValidatorDelegationsRequest {
- const message = { ...baseQueryValidatorDelegationsRequest } as QueryValidatorDelegationsRequest;
- if (object.validatorAddr !== undefined && object.validatorAddr !== null) {
- message.validatorAddr = String(object.validatorAddr);
- } else {
- message.validatorAddr = "";
- }
- if (object.pagination !== undefined && object.pagination !== null) {
- message.pagination = PageRequest.fromJSON(object.pagination);
- } else {
- message.pagination = undefined;
- }
- return message;
+ return {
+ validatorAddr: isSet(object.validatorAddr) ? String(object.validatorAddr) : "",
+ pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined,
+ };
},
toJSON(message: QueryValidatorDelegationsRequest): unknown {
@@ -577,19 +547,22 @@ export const QueryValidatorDelegationsRequest = {
return obj;
},
- fromPartial(object: DeepPartial): QueryValidatorDelegationsRequest {
- const message = { ...baseQueryValidatorDelegationsRequest } as QueryValidatorDelegationsRequest;
+ fromPartial, I>>(
+ object: I,
+ ): QueryValidatorDelegationsRequest {
+ const message = createBaseQueryValidatorDelegationsRequest();
message.validatorAddr = object.validatorAddr ?? "";
- if (object.pagination !== undefined && object.pagination !== null) {
- message.pagination = PageRequest.fromPartial(object.pagination);
- } else {
- message.pagination = undefined;
- }
+ message.pagination =
+ object.pagination !== undefined && object.pagination !== null
+ ? PageRequest.fromPartial(object.pagination)
+ : undefined;
return message;
},
};
-const baseQueryValidatorDelegationsResponse: object = {};
+function createBaseQueryValidatorDelegationsResponse(): QueryValidatorDelegationsResponse {
+ return { delegationResponses: [], pagination: undefined };
+}
export const QueryValidatorDelegationsResponse = {
encode(message: QueryValidatorDelegationsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -605,8 +578,7 @@ export const QueryValidatorDelegationsResponse = {
decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDelegationsResponse {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseQueryValidatorDelegationsResponse } as QueryValidatorDelegationsResponse;
- message.delegationResponses = [];
+ const message = createBaseQueryValidatorDelegationsResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -625,19 +597,12 @@ export const QueryValidatorDelegationsResponse = {
},
fromJSON(object: any): QueryValidatorDelegationsResponse {
- const message = { ...baseQueryValidatorDelegationsResponse } as QueryValidatorDelegationsResponse;
- message.delegationResponses = [];
- if (object.delegationResponses !== undefined && object.delegationResponses !== null) {
- for (const e of object.delegationResponses) {
- message.delegationResponses.push(DelegationResponse.fromJSON(e));
- }
- }
- if (object.pagination !== undefined && object.pagination !== null) {
- message.pagination = PageResponse.fromJSON(object.pagination);
- } else {
- message.pagination = undefined;
- }
- return message;
+ return {
+ delegationResponses: Array.isArray(object?.delegationResponses)
+ ? object.delegationResponses.map((e: any) => DelegationResponse.fromJSON(e))
+ : [],
+ pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined,
+ };
},
toJSON(message: QueryValidatorDelegationsResponse): unknown {
@@ -654,24 +619,23 @@ export const QueryValidatorDelegationsResponse = {
return obj;
},
- fromPartial(object: DeepPartial): QueryValidatorDelegationsResponse {
- const message = { ...baseQueryValidatorDelegationsResponse } as QueryValidatorDelegationsResponse;
- message.delegationResponses = [];
- if (object.delegationResponses !== undefined && object.delegationResponses !== null) {
- for (const e of object.delegationResponses) {
- message.delegationResponses.push(DelegationResponse.fromPartial(e));
- }
- }
- if (object.pagination !== undefined && object.pagination !== null) {
- message.pagination = PageResponse.fromPartial(object.pagination);
- } else {
- message.pagination = undefined;
- }
+ fromPartial, I>>(
+ object: I,
+ ): QueryValidatorDelegationsResponse {
+ const message = createBaseQueryValidatorDelegationsResponse();
+ message.delegationResponses =
+ object.delegationResponses?.map((e) => DelegationResponse.fromPartial(e)) || [];
+ message.pagination =
+ object.pagination !== undefined && object.pagination !== null
+ ? PageResponse.fromPartial(object.pagination)
+ : undefined;
return message;
},
};
-const baseQueryValidatorUnbondingDelegationsRequest: object = { validatorAddr: "" };
+function createBaseQueryValidatorUnbondingDelegationsRequest(): QueryValidatorUnbondingDelegationsRequest {
+ return { validatorAddr: "", pagination: undefined };
+}
export const QueryValidatorUnbondingDelegationsRequest = {
encode(
@@ -690,9 +654,7 @@ export const QueryValidatorUnbondingDelegationsRequest = {
decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorUnbondingDelegationsRequest {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = {
- ...baseQueryValidatorUnbondingDelegationsRequest,
- } as QueryValidatorUnbondingDelegationsRequest;
+ const message = createBaseQueryValidatorUnbondingDelegationsRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -711,20 +673,10 @@ export const QueryValidatorUnbondingDelegationsRequest = {
},
fromJSON(object: any): QueryValidatorUnbondingDelegationsRequest {
- const message = {
- ...baseQueryValidatorUnbondingDelegationsRequest,
- } as QueryValidatorUnbondingDelegationsRequest;
- if (object.validatorAddr !== undefined && object.validatorAddr !== null) {
- message.validatorAddr = String(object.validatorAddr);
- } else {
- message.validatorAddr = "";
- }
- if (object.pagination !== undefined && object.pagination !== null) {
- message.pagination = PageRequest.fromJSON(object.pagination);
- } else {
- message.pagination = undefined;
- }
- return message;
+ return {
+ validatorAddr: isSet(object.validatorAddr) ? String(object.validatorAddr) : "",
+ pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined,
+ };
},
toJSON(message: QueryValidatorUnbondingDelegationsRequest): unknown {
@@ -735,23 +687,22 @@ export const QueryValidatorUnbondingDelegationsRequest = {
return obj;
},
- fromPartial(
- object: DeepPartial,
+ fromPartial, I>>(
+ object: I,
): QueryValidatorUnbondingDelegationsRequest {
- const message = {
- ...baseQueryValidatorUnbondingDelegationsRequest,
- } as QueryValidatorUnbondingDelegationsRequest;
+ const message = createBaseQueryValidatorUnbondingDelegationsRequest();
message.validatorAddr = object.validatorAddr ?? "";
- if (object.pagination !== undefined && object.pagination !== null) {
- message.pagination = PageRequest.fromPartial(object.pagination);
- } else {
- message.pagination = undefined;
- }
+ message.pagination =
+ object.pagination !== undefined && object.pagination !== null
+ ? PageRequest.fromPartial(object.pagination)
+ : undefined;
return message;
},
};
-const baseQueryValidatorUnbondingDelegationsResponse: object = {};
+function createBaseQueryValidatorUnbondingDelegationsResponse(): QueryValidatorUnbondingDelegationsResponse {
+ return { unbondingResponses: [], pagination: undefined };
+}
export const QueryValidatorUnbondingDelegationsResponse = {
encode(
@@ -770,10 +721,7 @@ export const QueryValidatorUnbondingDelegationsResponse = {
decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorUnbondingDelegationsResponse {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = {
- ...baseQueryValidatorUnbondingDelegationsResponse,
- } as QueryValidatorUnbondingDelegationsResponse;
- message.unbondingResponses = [];
+ const message = createBaseQueryValidatorUnbondingDelegationsResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -792,21 +740,12 @@ export const QueryValidatorUnbondingDelegationsResponse = {
},
fromJSON(object: any): QueryValidatorUnbondingDelegationsResponse {
- const message = {
- ...baseQueryValidatorUnbondingDelegationsResponse,
- } as QueryValidatorUnbondingDelegationsResponse;
- message.unbondingResponses = [];
- if (object.unbondingResponses !== undefined && object.unbondingResponses !== null) {
- for (const e of object.unbondingResponses) {
- message.unbondingResponses.push(UnbondingDelegation.fromJSON(e));
- }
- }
- if (object.pagination !== undefined && object.pagination !== null) {
- message.pagination = PageResponse.fromJSON(object.pagination);
- } else {
- message.pagination = undefined;
- }
- return message;
+ return {
+ unbondingResponses: Array.isArray(object?.unbondingResponses)
+ ? object.unbondingResponses.map((e: any) => UnbondingDelegation.fromJSON(e))
+ : [],
+ pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined,
+ };
},
toJSON(message: QueryValidatorUnbondingDelegationsResponse): unknown {
@@ -823,28 +762,23 @@ export const QueryValidatorUnbondingDelegationsResponse = {
return obj;
},
- fromPartial(
- object: DeepPartial,
+ fromPartial, I>>(
+ object: I,
): QueryValidatorUnbondingDelegationsResponse {
- const message = {
- ...baseQueryValidatorUnbondingDelegationsResponse,
- } as QueryValidatorUnbondingDelegationsResponse;
- message.unbondingResponses = [];
- if (object.unbondingResponses !== undefined && object.unbondingResponses !== null) {
- for (const e of object.unbondingResponses) {
- message.unbondingResponses.push(UnbondingDelegation.fromPartial(e));
- }
- }
- if (object.pagination !== undefined && object.pagination !== null) {
- message.pagination = PageResponse.fromPartial(object.pagination);
- } else {
- message.pagination = undefined;
- }
+ const message = createBaseQueryValidatorUnbondingDelegationsResponse();
+ message.unbondingResponses =
+ object.unbondingResponses?.map((e) => UnbondingDelegation.fromPartial(e)) || [];
+ message.pagination =
+ object.pagination !== undefined && object.pagination !== null
+ ? PageResponse.fromPartial(object.pagination)
+ : undefined;
return message;
},
};
-const baseQueryDelegationRequest: object = { delegatorAddr: "", validatorAddr: "" };
+function createBaseQueryDelegationRequest(): QueryDelegationRequest {
+ return { delegatorAddr: "", validatorAddr: "" };
+}
export const QueryDelegationRequest = {
encode(message: QueryDelegationRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -860,7 +794,7 @@ export const QueryDelegationRequest = {
decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationRequest {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseQueryDelegationRequest } as QueryDelegationRequest;
+ const message = createBaseQueryDelegationRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -879,18 +813,10 @@ export const QueryDelegationRequest = {
},
fromJSON(object: any): QueryDelegationRequest {
- const message = { ...baseQueryDelegationRequest } as QueryDelegationRequest;
- if (object.delegatorAddr !== undefined && object.delegatorAddr !== null) {
- message.delegatorAddr = String(object.delegatorAddr);
- } else {
- message.delegatorAddr = "";
- }
- if (object.validatorAddr !== undefined && object.validatorAddr !== null) {
- message.validatorAddr = String(object.validatorAddr);
- } else {
- message.validatorAddr = "";
- }
- return message;
+ return {
+ delegatorAddr: isSet(object.delegatorAddr) ? String(object.delegatorAddr) : "",
+ validatorAddr: isSet(object.validatorAddr) ? String(object.validatorAddr) : "",
+ };
},
toJSON(message: QueryDelegationRequest): unknown {
@@ -900,15 +826,17 @@ export const QueryDelegationRequest = {
return obj;
},
- fromPartial(object: DeepPartial): QueryDelegationRequest {
- const message = { ...baseQueryDelegationRequest } as QueryDelegationRequest;
+ fromPartial, I>>(object: I): QueryDelegationRequest {
+ const message = createBaseQueryDelegationRequest();
message.delegatorAddr = object.delegatorAddr ?? "";
message.validatorAddr = object.validatorAddr ?? "";
return message;
},
};
-const baseQueryDelegationResponse: object = {};
+function createBaseQueryDelegationResponse(): QueryDelegationResponse {
+ return { delegationResponse: undefined };
+}
export const QueryDelegationResponse = {
encode(message: QueryDelegationResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -921,7 +849,7 @@ export const QueryDelegationResponse = {
decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationResponse {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseQueryDelegationResponse } as QueryDelegationResponse;
+ const message = createBaseQueryDelegationResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -937,13 +865,11 @@ export const QueryDelegationResponse = {
},
fromJSON(object: any): QueryDelegationResponse {
- const message = { ...baseQueryDelegationResponse } as QueryDelegationResponse;
- if (object.delegationResponse !== undefined && object.delegationResponse !== null) {
- message.delegationResponse = DelegationResponse.fromJSON(object.delegationResponse);
- } else {
- message.delegationResponse = undefined;
- }
- return message;
+ return {
+ delegationResponse: isSet(object.delegationResponse)
+ ? DelegationResponse.fromJSON(object.delegationResponse)
+ : undefined,
+ };
},
toJSON(message: QueryDelegationResponse): unknown {
@@ -955,18 +881,19 @@ export const QueryDelegationResponse = {
return obj;
},
- fromPartial(object: DeepPartial): QueryDelegationResponse {
- const message = { ...baseQueryDelegationResponse } as QueryDelegationResponse;
- if (object.delegationResponse !== undefined && object.delegationResponse !== null) {
- message.delegationResponse = DelegationResponse.fromPartial(object.delegationResponse);
- } else {
- message.delegationResponse = undefined;
- }
+ fromPartial, I>>(object: I): QueryDelegationResponse {
+ const message = createBaseQueryDelegationResponse();
+ message.delegationResponse =
+ object.delegationResponse !== undefined && object.delegationResponse !== null
+ ? DelegationResponse.fromPartial(object.delegationResponse)
+ : undefined;
return message;
},
};
-const baseQueryUnbondingDelegationRequest: object = { delegatorAddr: "", validatorAddr: "" };
+function createBaseQueryUnbondingDelegationRequest(): QueryUnbondingDelegationRequest {
+ return { delegatorAddr: "", validatorAddr: "" };
+}
export const QueryUnbondingDelegationRequest = {
encode(message: QueryUnbondingDelegationRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -982,7 +909,7 @@ export const QueryUnbondingDelegationRequest = {
decode(input: _m0.Reader | Uint8Array, length?: number): QueryUnbondingDelegationRequest {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseQueryUnbondingDelegationRequest } as QueryUnbondingDelegationRequest;
+ const message = createBaseQueryUnbondingDelegationRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -1001,18 +928,10 @@ export const QueryUnbondingDelegationRequest = {
},
fromJSON(object: any): QueryUnbondingDelegationRequest {
- const message = { ...baseQueryUnbondingDelegationRequest } as QueryUnbondingDelegationRequest;
- if (object.delegatorAddr !== undefined && object.delegatorAddr !== null) {
- message.delegatorAddr = String(object.delegatorAddr);
- } else {
- message.delegatorAddr = "";
- }
- if (object.validatorAddr !== undefined && object.validatorAddr !== null) {
- message.validatorAddr = String(object.validatorAddr);
- } else {
- message.validatorAddr = "";
- }
- return message;
+ return {
+ delegatorAddr: isSet(object.delegatorAddr) ? String(object.delegatorAddr) : "",
+ validatorAddr: isSet(object.validatorAddr) ? String(object.validatorAddr) : "",
+ };
},
toJSON(message: QueryUnbondingDelegationRequest): unknown {
@@ -1022,15 +941,19 @@ export const QueryUnbondingDelegationRequest = {
return obj;
},
- fromPartial(object: DeepPartial): QueryUnbondingDelegationRequest {
- const message = { ...baseQueryUnbondingDelegationRequest } as QueryUnbondingDelegationRequest;
+ fromPartial, I>>(
+ object: I,
+ ): QueryUnbondingDelegationRequest {
+ const message = createBaseQueryUnbondingDelegationRequest();
message.delegatorAddr = object.delegatorAddr ?? "";
message.validatorAddr = object.validatorAddr ?? "";
return message;
},
};
-const baseQueryUnbondingDelegationResponse: object = {};
+function createBaseQueryUnbondingDelegationResponse(): QueryUnbondingDelegationResponse {
+ return { unbond: undefined };
+}
export const QueryUnbondingDelegationResponse = {
encode(message: QueryUnbondingDelegationResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -1043,7 +966,7 @@ export const QueryUnbondingDelegationResponse = {
decode(input: _m0.Reader | Uint8Array, length?: number): QueryUnbondingDelegationResponse {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseQueryUnbondingDelegationResponse } as QueryUnbondingDelegationResponse;
+ const message = createBaseQueryUnbondingDelegationResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -1059,13 +982,9 @@ export const QueryUnbondingDelegationResponse = {
},
fromJSON(object: any): QueryUnbondingDelegationResponse {
- const message = { ...baseQueryUnbondingDelegationResponse } as QueryUnbondingDelegationResponse;
- if (object.unbond !== undefined && object.unbond !== null) {
- message.unbond = UnbondingDelegation.fromJSON(object.unbond);
- } else {
- message.unbond = undefined;
- }
- return message;
+ return {
+ unbond: isSet(object.unbond) ? UnbondingDelegation.fromJSON(object.unbond) : undefined,
+ };
},
toJSON(message: QueryUnbondingDelegationResponse): unknown {
@@ -1075,18 +994,21 @@ export const QueryUnbondingDelegationResponse = {
return obj;
},
- fromPartial(object: DeepPartial): QueryUnbondingDelegationResponse {
- const message = { ...baseQueryUnbondingDelegationResponse } as QueryUnbondingDelegationResponse;
- if (object.unbond !== undefined && object.unbond !== null) {
- message.unbond = UnbondingDelegation.fromPartial(object.unbond);
- } else {
- message.unbond = undefined;
- }
+ fromPartial, I>>(
+ object: I,
+ ): QueryUnbondingDelegationResponse {
+ const message = createBaseQueryUnbondingDelegationResponse();
+ message.unbond =
+ object.unbond !== undefined && object.unbond !== null
+ ? UnbondingDelegation.fromPartial(object.unbond)
+ : undefined;
return message;
},
};
-const baseQueryDelegatorDelegationsRequest: object = { delegatorAddr: "" };
+function createBaseQueryDelegatorDelegationsRequest(): QueryDelegatorDelegationsRequest {
+ return { delegatorAddr: "", pagination: undefined };
+}
export const QueryDelegatorDelegationsRequest = {
encode(message: QueryDelegatorDelegationsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -1102,7 +1024,7 @@ export const QueryDelegatorDelegationsRequest = {
decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorDelegationsRequest {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseQueryDelegatorDelegationsRequest } as QueryDelegatorDelegationsRequest;
+ const message = createBaseQueryDelegatorDelegationsRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -1121,18 +1043,10 @@ export const QueryDelegatorDelegationsRequest = {
},
fromJSON(object: any): QueryDelegatorDelegationsRequest {
- const message = { ...baseQueryDelegatorDelegationsRequest } as QueryDelegatorDelegationsRequest;
- if (object.delegatorAddr !== undefined && object.delegatorAddr !== null) {
- message.delegatorAddr = String(object.delegatorAddr);
- } else {
- message.delegatorAddr = "";
- }
- if (object.pagination !== undefined && object.pagination !== null) {
- message.pagination = PageRequest.fromJSON(object.pagination);
- } else {
- message.pagination = undefined;
- }
- return message;
+ return {
+ delegatorAddr: isSet(object.delegatorAddr) ? String(object.delegatorAddr) : "",
+ pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined,
+ };
},
toJSON(message: QueryDelegatorDelegationsRequest): unknown {
@@ -1143,19 +1057,22 @@ export const QueryDelegatorDelegationsRequest = {
return obj;
},
- fromPartial(object: DeepPartial): QueryDelegatorDelegationsRequest {
- const message = { ...baseQueryDelegatorDelegationsRequest } as QueryDelegatorDelegationsRequest;
+ fromPartial, I>>(
+ object: I,
+ ): QueryDelegatorDelegationsRequest {
+ const message = createBaseQueryDelegatorDelegationsRequest();
message.delegatorAddr = object.delegatorAddr ?? "";
- if (object.pagination !== undefined && object.pagination !== null) {
- message.pagination = PageRequest.fromPartial(object.pagination);
- } else {
- message.pagination = undefined;
- }
+ message.pagination =
+ object.pagination !== undefined && object.pagination !== null
+ ? PageRequest.fromPartial(object.pagination)
+ : undefined;
return message;
},
};
-const baseQueryDelegatorDelegationsResponse: object = {};
+function createBaseQueryDelegatorDelegationsResponse(): QueryDelegatorDelegationsResponse {
+ return { delegationResponses: [], pagination: undefined };
+}
export const QueryDelegatorDelegationsResponse = {
encode(message: QueryDelegatorDelegationsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -1171,8 +1088,7 @@ export const QueryDelegatorDelegationsResponse = {
decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorDelegationsResponse {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseQueryDelegatorDelegationsResponse } as QueryDelegatorDelegationsResponse;
- message.delegationResponses = [];
+ const message = createBaseQueryDelegatorDelegationsResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -1191,19 +1107,12 @@ export const QueryDelegatorDelegationsResponse = {
},
fromJSON(object: any): QueryDelegatorDelegationsResponse {
- const message = { ...baseQueryDelegatorDelegationsResponse } as QueryDelegatorDelegationsResponse;
- message.delegationResponses = [];
- if (object.delegationResponses !== undefined && object.delegationResponses !== null) {
- for (const e of object.delegationResponses) {
- message.delegationResponses.push(DelegationResponse.fromJSON(e));
- }
- }
- if (object.pagination !== undefined && object.pagination !== null) {
- message.pagination = PageResponse.fromJSON(object.pagination);
- } else {
- message.pagination = undefined;
- }
- return message;
+ return {
+ delegationResponses: Array.isArray(object?.delegationResponses)
+ ? object.delegationResponses.map((e: any) => DelegationResponse.fromJSON(e))
+ : [],
+ pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined,
+ };
},
toJSON(message: QueryDelegatorDelegationsResponse): unknown {
@@ -1220,24 +1129,23 @@ export const QueryDelegatorDelegationsResponse = {
return obj;
},
- fromPartial(object: DeepPartial): QueryDelegatorDelegationsResponse {
- const message = { ...baseQueryDelegatorDelegationsResponse } as QueryDelegatorDelegationsResponse;
- message.delegationResponses = [];
- if (object.delegationResponses !== undefined && object.delegationResponses !== null) {
- for (const e of object.delegationResponses) {
- message.delegationResponses.push(DelegationResponse.fromPartial(e));
- }
- }
- if (object.pagination !== undefined && object.pagination !== null) {
- message.pagination = PageResponse.fromPartial(object.pagination);
- } else {
- message.pagination = undefined;
- }
+ fromPartial, I>>(
+ object: I,
+ ): QueryDelegatorDelegationsResponse {
+ const message = createBaseQueryDelegatorDelegationsResponse();
+ message.delegationResponses =
+ object.delegationResponses?.map((e) => DelegationResponse.fromPartial(e)) || [];
+ message.pagination =
+ object.pagination !== undefined && object.pagination !== null
+ ? PageResponse.fromPartial(object.pagination)
+ : undefined;
return message;
},
};
-const baseQueryDelegatorUnbondingDelegationsRequest: object = { delegatorAddr: "" };
+function createBaseQueryDelegatorUnbondingDelegationsRequest(): QueryDelegatorUnbondingDelegationsRequest {
+ return { delegatorAddr: "", pagination: undefined };
+}
export const QueryDelegatorUnbondingDelegationsRequest = {
encode(
@@ -1256,9 +1164,7 @@ export const QueryDelegatorUnbondingDelegationsRequest = {
decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorUnbondingDelegationsRequest {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = {
- ...baseQueryDelegatorUnbondingDelegationsRequest,
- } as QueryDelegatorUnbondingDelegationsRequest;
+ const message = createBaseQueryDelegatorUnbondingDelegationsRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -1277,20 +1183,10 @@ export const QueryDelegatorUnbondingDelegationsRequest = {
},
fromJSON(object: any): QueryDelegatorUnbondingDelegationsRequest {
- const message = {
- ...baseQueryDelegatorUnbondingDelegationsRequest,
- } as QueryDelegatorUnbondingDelegationsRequest;
- if (object.delegatorAddr !== undefined && object.delegatorAddr !== null) {
- message.delegatorAddr = String(object.delegatorAddr);
- } else {
- message.delegatorAddr = "";
- }
- if (object.pagination !== undefined && object.pagination !== null) {
- message.pagination = PageRequest.fromJSON(object.pagination);
- } else {
- message.pagination = undefined;
- }
- return message;
+ return {
+ delegatorAddr: isSet(object.delegatorAddr) ? String(object.delegatorAddr) : "",
+ pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined,
+ };
},
toJSON(message: QueryDelegatorUnbondingDelegationsRequest): unknown {
@@ -1301,23 +1197,22 @@ export const QueryDelegatorUnbondingDelegationsRequest = {
return obj;
},
- fromPartial(
- object: DeepPartial,
+ fromPartial, I>>(
+ object: I,
): QueryDelegatorUnbondingDelegationsRequest {
- const message = {
- ...baseQueryDelegatorUnbondingDelegationsRequest,
- } as QueryDelegatorUnbondingDelegationsRequest;
+ const message = createBaseQueryDelegatorUnbondingDelegationsRequest();
message.delegatorAddr = object.delegatorAddr ?? "";
- if (object.pagination !== undefined && object.pagination !== null) {
- message.pagination = PageRequest.fromPartial(object.pagination);
- } else {
- message.pagination = undefined;
- }
+ message.pagination =
+ object.pagination !== undefined && object.pagination !== null
+ ? PageRequest.fromPartial(object.pagination)
+ : undefined;
return message;
},
};
-const baseQueryDelegatorUnbondingDelegationsResponse: object = {};
+function createBaseQueryDelegatorUnbondingDelegationsResponse(): QueryDelegatorUnbondingDelegationsResponse {
+ return { unbondingResponses: [], pagination: undefined };
+}
export const QueryDelegatorUnbondingDelegationsResponse = {
encode(
@@ -1336,10 +1231,7 @@ export const QueryDelegatorUnbondingDelegationsResponse = {
decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorUnbondingDelegationsResponse {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = {
- ...baseQueryDelegatorUnbondingDelegationsResponse,
- } as QueryDelegatorUnbondingDelegationsResponse;
- message.unbondingResponses = [];
+ const message = createBaseQueryDelegatorUnbondingDelegationsResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -1358,21 +1250,12 @@ export const QueryDelegatorUnbondingDelegationsResponse = {
},
fromJSON(object: any): QueryDelegatorUnbondingDelegationsResponse {
- const message = {
- ...baseQueryDelegatorUnbondingDelegationsResponse,
- } as QueryDelegatorUnbondingDelegationsResponse;
- message.unbondingResponses = [];
- if (object.unbondingResponses !== undefined && object.unbondingResponses !== null) {
- for (const e of object.unbondingResponses) {
- message.unbondingResponses.push(UnbondingDelegation.fromJSON(e));
- }
- }
- if (object.pagination !== undefined && object.pagination !== null) {
- message.pagination = PageResponse.fromJSON(object.pagination);
- } else {
- message.pagination = undefined;
- }
- return message;
+ return {
+ unbondingResponses: Array.isArray(object?.unbondingResponses)
+ ? object.unbondingResponses.map((e: any) => UnbondingDelegation.fromJSON(e))
+ : [],
+ pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined,
+ };
},
toJSON(message: QueryDelegatorUnbondingDelegationsResponse): unknown {
@@ -1389,32 +1272,23 @@ export const QueryDelegatorUnbondingDelegationsResponse = {
return obj;
},
- fromPartial(
- object: DeepPartial,
+ fromPartial, I>>(
+ object: I,
): QueryDelegatorUnbondingDelegationsResponse {
- const message = {
- ...baseQueryDelegatorUnbondingDelegationsResponse,
- } as QueryDelegatorUnbondingDelegationsResponse;
- message.unbondingResponses = [];
- if (object.unbondingResponses !== undefined && object.unbondingResponses !== null) {
- for (const e of object.unbondingResponses) {
- message.unbondingResponses.push(UnbondingDelegation.fromPartial(e));
- }
- }
- if (object.pagination !== undefined && object.pagination !== null) {
- message.pagination = PageResponse.fromPartial(object.pagination);
- } else {
- message.pagination = undefined;
- }
+ const message = createBaseQueryDelegatorUnbondingDelegationsResponse();
+ message.unbondingResponses =
+ object.unbondingResponses?.map((e) => UnbondingDelegation.fromPartial(e)) || [];
+ message.pagination =
+ object.pagination !== undefined && object.pagination !== null
+ ? PageResponse.fromPartial(object.pagination)
+ : undefined;
return message;
},
};
-const baseQueryRedelegationsRequest: object = {
- delegatorAddr: "",
- srcValidatorAddr: "",
- dstValidatorAddr: "",
-};
+function createBaseQueryRedelegationsRequest(): QueryRedelegationsRequest {
+ return { delegatorAddr: "", srcValidatorAddr: "", dstValidatorAddr: "", pagination: undefined };
+}
export const QueryRedelegationsRequest = {
encode(message: QueryRedelegationsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -1436,7 +1310,7 @@ export const QueryRedelegationsRequest = {
decode(input: _m0.Reader | Uint8Array, length?: number): QueryRedelegationsRequest {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseQueryRedelegationsRequest } as QueryRedelegationsRequest;
+ const message = createBaseQueryRedelegationsRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -1461,28 +1335,12 @@ export const QueryRedelegationsRequest = {
},
fromJSON(object: any): QueryRedelegationsRequest {
- const message = { ...baseQueryRedelegationsRequest } as QueryRedelegationsRequest;
- if (object.delegatorAddr !== undefined && object.delegatorAddr !== null) {
- message.delegatorAddr = String(object.delegatorAddr);
- } else {
- message.delegatorAddr = "";
- }
- if (object.srcValidatorAddr !== undefined && object.srcValidatorAddr !== null) {
- message.srcValidatorAddr = String(object.srcValidatorAddr);
- } else {
- message.srcValidatorAddr = "";
- }
- if (object.dstValidatorAddr !== undefined && object.dstValidatorAddr !== null) {
- message.dstValidatorAddr = String(object.dstValidatorAddr);
- } else {
- message.dstValidatorAddr = "";
- }
- if (object.pagination !== undefined && object.pagination !== null) {
- message.pagination = PageRequest.fromJSON(object.pagination);
- } else {
- message.pagination = undefined;
- }
- return message;
+ return {
+ delegatorAddr: isSet(object.delegatorAddr) ? String(object.delegatorAddr) : "",
+ srcValidatorAddr: isSet(object.srcValidatorAddr) ? String(object.srcValidatorAddr) : "",
+ dstValidatorAddr: isSet(object.dstValidatorAddr) ? String(object.dstValidatorAddr) : "",
+ pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined,
+ };
},
toJSON(message: QueryRedelegationsRequest): unknown {
@@ -1495,21 +1353,24 @@ export const QueryRedelegationsRequest = {
return obj;
},
- fromPartial(object: DeepPartial): QueryRedelegationsRequest {
- const message = { ...baseQueryRedelegationsRequest } as QueryRedelegationsRequest;
+ fromPartial, I>>(
+ object: I,
+ ): QueryRedelegationsRequest {
+ const message = createBaseQueryRedelegationsRequest();
message.delegatorAddr = object.delegatorAddr ?? "";
message.srcValidatorAddr = object.srcValidatorAddr ?? "";
message.dstValidatorAddr = object.dstValidatorAddr ?? "";
- if (object.pagination !== undefined && object.pagination !== null) {
- message.pagination = PageRequest.fromPartial(object.pagination);
- } else {
- message.pagination = undefined;
- }
+ message.pagination =
+ object.pagination !== undefined && object.pagination !== null
+ ? PageRequest.fromPartial(object.pagination)
+ : undefined;
return message;
},
};
-const baseQueryRedelegationsResponse: object = {};
+function createBaseQueryRedelegationsResponse(): QueryRedelegationsResponse {
+ return { redelegationResponses: [], pagination: undefined };
+}
export const QueryRedelegationsResponse = {
encode(message: QueryRedelegationsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -1525,8 +1386,7 @@ export const QueryRedelegationsResponse = {
decode(input: _m0.Reader | Uint8Array, length?: number): QueryRedelegationsResponse {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseQueryRedelegationsResponse } as QueryRedelegationsResponse;
- message.redelegationResponses = [];
+ const message = createBaseQueryRedelegationsResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -1545,19 +1405,12 @@ export const QueryRedelegationsResponse = {
},
fromJSON(object: any): QueryRedelegationsResponse {
- const message = { ...baseQueryRedelegationsResponse } as QueryRedelegationsResponse;
- message.redelegationResponses = [];
- if (object.redelegationResponses !== undefined && object.redelegationResponses !== null) {
- for (const e of object.redelegationResponses) {
- message.redelegationResponses.push(RedelegationResponse.fromJSON(e));
- }
- }
- if (object.pagination !== undefined && object.pagination !== null) {
- message.pagination = PageResponse.fromJSON(object.pagination);
- } else {
- message.pagination = undefined;
- }
- return message;
+ return {
+ redelegationResponses: Array.isArray(object?.redelegationResponses)
+ ? object.redelegationResponses.map((e: any) => RedelegationResponse.fromJSON(e))
+ : [],
+ pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined,
+ };
},
toJSON(message: QueryRedelegationsResponse): unknown {
@@ -1574,24 +1427,23 @@ export const QueryRedelegationsResponse = {
return obj;
},
- fromPartial(object: DeepPartial): QueryRedelegationsResponse {
- const message = { ...baseQueryRedelegationsResponse } as QueryRedelegationsResponse;
- message.redelegationResponses = [];
- if (object.redelegationResponses !== undefined && object.redelegationResponses !== null) {
- for (const e of object.redelegationResponses) {
- message.redelegationResponses.push(RedelegationResponse.fromPartial(e));
- }
- }
- if (object.pagination !== undefined && object.pagination !== null) {
- message.pagination = PageResponse.fromPartial(object.pagination);
- } else {
- message.pagination = undefined;
- }
+ fromPartial, I>>(
+ object: I,
+ ): QueryRedelegationsResponse {
+ const message = createBaseQueryRedelegationsResponse();
+ message.redelegationResponses =
+ object.redelegationResponses?.map((e) => RedelegationResponse.fromPartial(e)) || [];
+ message.pagination =
+ object.pagination !== undefined && object.pagination !== null
+ ? PageResponse.fromPartial(object.pagination)
+ : undefined;
return message;
},
};
-const baseQueryDelegatorValidatorsRequest: object = { delegatorAddr: "" };
+function createBaseQueryDelegatorValidatorsRequest(): QueryDelegatorValidatorsRequest {
+ return { delegatorAddr: "", pagination: undefined };
+}
export const QueryDelegatorValidatorsRequest = {
encode(message: QueryDelegatorValidatorsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -1607,7 +1459,7 @@ export const QueryDelegatorValidatorsRequest = {
decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorValidatorsRequest {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseQueryDelegatorValidatorsRequest } as QueryDelegatorValidatorsRequest;
+ const message = createBaseQueryDelegatorValidatorsRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -1626,18 +1478,10 @@ export const QueryDelegatorValidatorsRequest = {
},
fromJSON(object: any): QueryDelegatorValidatorsRequest {
- const message = { ...baseQueryDelegatorValidatorsRequest } as QueryDelegatorValidatorsRequest;
- if (object.delegatorAddr !== undefined && object.delegatorAddr !== null) {
- message.delegatorAddr = String(object.delegatorAddr);
- } else {
- message.delegatorAddr = "";
- }
- if (object.pagination !== undefined && object.pagination !== null) {
- message.pagination = PageRequest.fromJSON(object.pagination);
- } else {
- message.pagination = undefined;
- }
- return message;
+ return {
+ delegatorAddr: isSet(object.delegatorAddr) ? String(object.delegatorAddr) : "",
+ pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined,
+ };
},
toJSON(message: QueryDelegatorValidatorsRequest): unknown {
@@ -1648,19 +1492,22 @@ export const QueryDelegatorValidatorsRequest = {
return obj;
},
- fromPartial(object: DeepPartial): QueryDelegatorValidatorsRequest {
- const message = { ...baseQueryDelegatorValidatorsRequest } as QueryDelegatorValidatorsRequest;
+ fromPartial, I>>(
+ object: I,
+ ): QueryDelegatorValidatorsRequest {
+ const message = createBaseQueryDelegatorValidatorsRequest();
message.delegatorAddr = object.delegatorAddr ?? "";
- if (object.pagination !== undefined && object.pagination !== null) {
- message.pagination = PageRequest.fromPartial(object.pagination);
- } else {
- message.pagination = undefined;
- }
+ message.pagination =
+ object.pagination !== undefined && object.pagination !== null
+ ? PageRequest.fromPartial(object.pagination)
+ : undefined;
return message;
},
};
-const baseQueryDelegatorValidatorsResponse: object = {};
+function createBaseQueryDelegatorValidatorsResponse(): QueryDelegatorValidatorsResponse {
+ return { validators: [], pagination: undefined };
+}
export const QueryDelegatorValidatorsResponse = {
encode(message: QueryDelegatorValidatorsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -1676,8 +1523,7 @@ export const QueryDelegatorValidatorsResponse = {
decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorValidatorsResponse {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseQueryDelegatorValidatorsResponse } as QueryDelegatorValidatorsResponse;
- message.validators = [];
+ const message = createBaseQueryDelegatorValidatorsResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -1696,19 +1542,12 @@ export const QueryDelegatorValidatorsResponse = {
},
fromJSON(object: any): QueryDelegatorValidatorsResponse {
- const message = { ...baseQueryDelegatorValidatorsResponse } as QueryDelegatorValidatorsResponse;
- message.validators = [];
- if (object.validators !== undefined && object.validators !== null) {
- for (const e of object.validators) {
- message.validators.push(Validator.fromJSON(e));
- }
- }
- if (object.pagination !== undefined && object.pagination !== null) {
- message.pagination = PageResponse.fromJSON(object.pagination);
- } else {
- message.pagination = undefined;
- }
- return message;
+ return {
+ validators: Array.isArray(object?.validators)
+ ? object.validators.map((e: any) => Validator.fromJSON(e))
+ : [],
+ pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined,
+ };
},
toJSON(message: QueryDelegatorValidatorsResponse): unknown {
@@ -1723,24 +1562,22 @@ export const QueryDelegatorValidatorsResponse = {
return obj;
},
- fromPartial(object: DeepPartial): QueryDelegatorValidatorsResponse {
- const message = { ...baseQueryDelegatorValidatorsResponse } as QueryDelegatorValidatorsResponse;
- message.validators = [];
- if (object.validators !== undefined && object.validators !== null) {
- for (const e of object.validators) {
- message.validators.push(Validator.fromPartial(e));
- }
- }
- if (object.pagination !== undefined && object.pagination !== null) {
- message.pagination = PageResponse.fromPartial(object.pagination);
- } else {
- message.pagination = undefined;
- }
+ fromPartial, I>>(
+ object: I,
+ ): QueryDelegatorValidatorsResponse {
+ const message = createBaseQueryDelegatorValidatorsResponse();
+ message.validators = object.validators?.map((e) => Validator.fromPartial(e)) || [];
+ message.pagination =
+ object.pagination !== undefined && object.pagination !== null
+ ? PageResponse.fromPartial(object.pagination)
+ : undefined;
return message;
},
};
-const baseQueryDelegatorValidatorRequest: object = { delegatorAddr: "", validatorAddr: "" };
+function createBaseQueryDelegatorValidatorRequest(): QueryDelegatorValidatorRequest {
+ return { delegatorAddr: "", validatorAddr: "" };
+}
export const QueryDelegatorValidatorRequest = {
encode(message: QueryDelegatorValidatorRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -1756,7 +1593,7 @@ export const QueryDelegatorValidatorRequest = {
decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorValidatorRequest {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseQueryDelegatorValidatorRequest } as QueryDelegatorValidatorRequest;
+ const message = createBaseQueryDelegatorValidatorRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -1775,18 +1612,10 @@ export const QueryDelegatorValidatorRequest = {
},
fromJSON(object: any): QueryDelegatorValidatorRequest {
- const message = { ...baseQueryDelegatorValidatorRequest } as QueryDelegatorValidatorRequest;
- if (object.delegatorAddr !== undefined && object.delegatorAddr !== null) {
- message.delegatorAddr = String(object.delegatorAddr);
- } else {
- message.delegatorAddr = "";
- }
- if (object.validatorAddr !== undefined && object.validatorAddr !== null) {
- message.validatorAddr = String(object.validatorAddr);
- } else {
- message.validatorAddr = "";
- }
- return message;
+ return {
+ delegatorAddr: isSet(object.delegatorAddr) ? String(object.delegatorAddr) : "",
+ validatorAddr: isSet(object.validatorAddr) ? String(object.validatorAddr) : "",
+ };
},
toJSON(message: QueryDelegatorValidatorRequest): unknown {
@@ -1796,15 +1625,19 @@ export const QueryDelegatorValidatorRequest = {
return obj;
},
- fromPartial(object: DeepPartial): QueryDelegatorValidatorRequest {
- const message = { ...baseQueryDelegatorValidatorRequest } as QueryDelegatorValidatorRequest;
+ fromPartial, I>>(
+ object: I,
+ ): QueryDelegatorValidatorRequest {
+ const message = createBaseQueryDelegatorValidatorRequest();
message.delegatorAddr = object.delegatorAddr ?? "";
message.validatorAddr = object.validatorAddr ?? "";
return message;
},
};
-const baseQueryDelegatorValidatorResponse: object = {};
+function createBaseQueryDelegatorValidatorResponse(): QueryDelegatorValidatorResponse {
+ return { validator: undefined };
+}
export const QueryDelegatorValidatorResponse = {
encode(message: QueryDelegatorValidatorResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -1817,7 +1650,7 @@ export const QueryDelegatorValidatorResponse = {
decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorValidatorResponse {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseQueryDelegatorValidatorResponse } as QueryDelegatorValidatorResponse;
+ const message = createBaseQueryDelegatorValidatorResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -1833,13 +1666,9 @@ export const QueryDelegatorValidatorResponse = {
},
fromJSON(object: any): QueryDelegatorValidatorResponse {
- const message = { ...baseQueryDelegatorValidatorResponse } as QueryDelegatorValidatorResponse;
- if (object.validator !== undefined && object.validator !== null) {
- message.validator = Validator.fromJSON(object.validator);
- } else {
- message.validator = undefined;
- }
- return message;
+ return {
+ validator: isSet(object.validator) ? Validator.fromJSON(object.validator) : undefined,
+ };
},
toJSON(message: QueryDelegatorValidatorResponse): unknown {
@@ -1849,18 +1678,21 @@ export const QueryDelegatorValidatorResponse = {
return obj;
},
- fromPartial(object: DeepPartial): QueryDelegatorValidatorResponse {
- const message = { ...baseQueryDelegatorValidatorResponse } as QueryDelegatorValidatorResponse;
- if (object.validator !== undefined && object.validator !== null) {
- message.validator = Validator.fromPartial(object.validator);
- } else {
- message.validator = undefined;
- }
+ fromPartial, I>>(
+ object: I,
+ ): QueryDelegatorValidatorResponse {
+ const message = createBaseQueryDelegatorValidatorResponse();
+ message.validator =
+ object.validator !== undefined && object.validator !== null
+ ? Validator.fromPartial(object.validator)
+ : undefined;
return message;
},
};
-const baseQueryHistoricalInfoRequest: object = { height: Long.ZERO };
+function createBaseQueryHistoricalInfoRequest(): QueryHistoricalInfoRequest {
+ return { height: Long.ZERO };
+}
export const QueryHistoricalInfoRequest = {
encode(message: QueryHistoricalInfoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -1873,7 +1705,7 @@ export const QueryHistoricalInfoRequest = {
decode(input: _m0.Reader | Uint8Array, length?: number): QueryHistoricalInfoRequest {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseQueryHistoricalInfoRequest } as QueryHistoricalInfoRequest;
+ const message = createBaseQueryHistoricalInfoRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -1889,13 +1721,9 @@ export const QueryHistoricalInfoRequest = {
},
fromJSON(object: any): QueryHistoricalInfoRequest {
- const message = { ...baseQueryHistoricalInfoRequest } as QueryHistoricalInfoRequest;
- if (object.height !== undefined && object.height !== null) {
- message.height = Long.fromString(object.height);
- } else {
- message.height = Long.ZERO;
- }
- return message;
+ return {
+ height: isSet(object.height) ? Long.fromString(object.height) : Long.ZERO,
+ };
},
toJSON(message: QueryHistoricalInfoRequest): unknown {
@@ -1904,18 +1732,19 @@ export const QueryHistoricalInfoRequest = {
return obj;
},
- fromPartial(object: DeepPartial): QueryHistoricalInfoRequest {
- const message = { ...baseQueryHistoricalInfoRequest } as QueryHistoricalInfoRequest;
- if (object.height !== undefined && object.height !== null) {
- message.height = object.height as Long;
- } else {
- message.height = Long.ZERO;
- }
+ fromPartial, I>>(
+ object: I,
+ ): QueryHistoricalInfoRequest {
+ const message = createBaseQueryHistoricalInfoRequest();
+ message.height =
+ object.height !== undefined && object.height !== null ? Long.fromValue(object.height) : Long.ZERO;
return message;
},
};
-const baseQueryHistoricalInfoResponse: object = {};
+function createBaseQueryHistoricalInfoResponse(): QueryHistoricalInfoResponse {
+ return { hist: undefined };
+}
export const QueryHistoricalInfoResponse = {
encode(message: QueryHistoricalInfoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -1928,7 +1757,7 @@ export const QueryHistoricalInfoResponse = {
decode(input: _m0.Reader | Uint8Array, length?: number): QueryHistoricalInfoResponse {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseQueryHistoricalInfoResponse } as QueryHistoricalInfoResponse;
+ const message = createBaseQueryHistoricalInfoResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -1944,13 +1773,9 @@ export const QueryHistoricalInfoResponse = {
},
fromJSON(object: any): QueryHistoricalInfoResponse {
- const message = { ...baseQueryHistoricalInfoResponse } as QueryHistoricalInfoResponse;
- if (object.hist !== undefined && object.hist !== null) {
- message.hist = HistoricalInfo.fromJSON(object.hist);
- } else {
- message.hist = undefined;
- }
- return message;
+ return {
+ hist: isSet(object.hist) ? HistoricalInfo.fromJSON(object.hist) : undefined,
+ };
},
toJSON(message: QueryHistoricalInfoResponse): unknown {
@@ -1959,18 +1784,19 @@ export const QueryHistoricalInfoResponse = {
return obj;
},
- fromPartial(object: DeepPartial): QueryHistoricalInfoResponse {
- const message = { ...baseQueryHistoricalInfoResponse } as QueryHistoricalInfoResponse;
- if (object.hist !== undefined && object.hist !== null) {
- message.hist = HistoricalInfo.fromPartial(object.hist);
- } else {
- message.hist = undefined;
- }
+ fromPartial, I>>(
+ object: I,
+ ): QueryHistoricalInfoResponse {
+ const message = createBaseQueryHistoricalInfoResponse();
+ message.hist =
+ object.hist !== undefined && object.hist !== null ? HistoricalInfo.fromPartial(object.hist) : undefined;
return message;
},
};
-const baseQueryPoolRequest: object = {};
+function createBaseQueryPoolRequest(): QueryPoolRequest {
+ return {};
+}
export const QueryPoolRequest = {
encode(_: QueryPoolRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -1980,7 +1806,7 @@ export const QueryPoolRequest = {
decode(input: _m0.Reader | Uint8Array, length?: number): QueryPoolRequest {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseQueryPoolRequest } as QueryPoolRequest;
+ const message = createBaseQueryPoolRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -1993,8 +1819,7 @@ export const QueryPoolRequest = {
},
fromJSON(_: any): QueryPoolRequest {
- const message = { ...baseQueryPoolRequest } as QueryPoolRequest;
- return message;
+ return {};
},
toJSON(_: QueryPoolRequest): unknown {
@@ -2002,13 +1827,15 @@ export const QueryPoolRequest = {
return obj;
},
- fromPartial(_: DeepPartial): QueryPoolRequest {
- const message = { ...baseQueryPoolRequest } as QueryPoolRequest;
+ fromPartial, I>>(_: I): QueryPoolRequest {
+ const message = createBaseQueryPoolRequest();
return message;
},
};
-const baseQueryPoolResponse: object = {};
+function createBaseQueryPoolResponse(): QueryPoolResponse {
+ return { pool: undefined };
+}
export const QueryPoolResponse = {
encode(message: QueryPoolResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -2021,7 +1848,7 @@ export const QueryPoolResponse = {
decode(input: _m0.Reader | Uint8Array, length?: number): QueryPoolResponse {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseQueryPoolResponse } as QueryPoolResponse;
+ const message = createBaseQueryPoolResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -2037,13 +1864,9 @@ export const QueryPoolResponse = {
},
fromJSON(object: any): QueryPoolResponse {
- const message = { ...baseQueryPoolResponse } as QueryPoolResponse;
- if (object.pool !== undefined && object.pool !== null) {
- message.pool = Pool.fromJSON(object.pool);
- } else {
- message.pool = undefined;
- }
- return message;
+ return {
+ pool: isSet(object.pool) ? Pool.fromJSON(object.pool) : undefined,
+ };
},
toJSON(message: QueryPoolResponse): unknown {
@@ -2052,18 +1875,17 @@ export const QueryPoolResponse = {
return obj;
},
- fromPartial(object: DeepPartial): QueryPoolResponse {
- const message = { ...baseQueryPoolResponse } as QueryPoolResponse;
- if (object.pool !== undefined && object.pool !== null) {
- message.pool = Pool.fromPartial(object.pool);
- } else {
- message.pool = undefined;
- }
+ fromPartial, I>>(object: I): QueryPoolResponse {
+ const message = createBaseQueryPoolResponse();
+ message.pool =
+ object.pool !== undefined && object.pool !== null ? Pool.fromPartial(object.pool) : undefined;
return message;
},
};
-const baseQueryParamsRequest: object = {};
+function createBaseQueryParamsRequest(): QueryParamsRequest {
+ return {};
+}
export const QueryParamsRequest = {
encode(_: QueryParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -2073,7 +1895,7 @@ export const QueryParamsRequest = {
decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseQueryParamsRequest } as QueryParamsRequest;
+ const message = createBaseQueryParamsRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -2086,8 +1908,7 @@ export const QueryParamsRequest = {
},
fromJSON(_: any): QueryParamsRequest {
- const message = { ...baseQueryParamsRequest } as QueryParamsRequest;
- return message;
+ return {};
},
toJSON(_: QueryParamsRequest): unknown {
@@ -2095,13 +1916,15 @@ export const QueryParamsRequest = {
return obj;
},
- fromPartial(_: DeepPartial): QueryParamsRequest {
- const message = { ...baseQueryParamsRequest } as QueryParamsRequest;
+ fromPartial, I>>(_: I): QueryParamsRequest {
+ const message = createBaseQueryParamsRequest();
return message;
},
};
-const baseQueryParamsResponse: object = {};
+function createBaseQueryParamsResponse(): QueryParamsResponse {
+ return { params: undefined };
+}
export const QueryParamsResponse = {
encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -2114,7 +1937,7 @@ export const QueryParamsResponse = {
decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseQueryParamsResponse } as QueryParamsResponse;
+ const message = createBaseQueryParamsResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -2130,13 +1953,9 @@ export const QueryParamsResponse = {
},
fromJSON(object: any): QueryParamsResponse {
- const message = { ...baseQueryParamsResponse } as QueryParamsResponse;
- if (object.params !== undefined && object.params !== null) {
- message.params = Params.fromJSON(object.params);
- } else {
- message.params = undefined;
- }
- return message;
+ return {
+ params: isSet(object.params) ? Params.fromJSON(object.params) : undefined,
+ };
},
toJSON(message: QueryParamsResponse): unknown {
@@ -2145,13 +1964,10 @@ export const QueryParamsResponse = {
return obj;
},
- fromPartial(object: DeepPartial): QueryParamsResponse {
- const message = { ...baseQueryParamsResponse } as QueryParamsResponse;
- if (object.params !== undefined && object.params !== null) {
- message.params = Params.fromPartial(object.params);
- } else {
- message.params = undefined;
- }
+ fromPartial, I>>(object: I): QueryParamsResponse {
+ const message = createBaseQueryParamsResponse();
+ message.params =
+ object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined;
return message;
},
};
@@ -2320,9 +2136,12 @@ interface Rpc {
request(service: string, method: string, data: Uint8Array): Promise;
}
-type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined | Long;
+type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
+
export type DeepPartial = T extends Builtin
? T
+ : T extends Long
+ ? string | number | Long
: T extends Array
? Array>
: T extends ReadonlyArray
@@ -2331,7 +2150,16 @@ export type DeepPartial = T extends Builtin
? { [K in keyof T]?: DeepPartial }
: Partial;
+type KeysOfUnion = T extends T ? keyof T : never;
+export type Exact = P extends Builtin
+ ? P
+ : P & { [K in keyof P]: Exact
} & Record>, never>;
+
if (_m0.util.Long !== Long) {
_m0.util.Long = Long as any;
_m0.configure();
}
+
+function isSet(value: any): boolean {
+ return value !== null && value !== undefined;
+}
diff --git a/src/codec/cosmos/staking/v1beta1/staking.ts b/src/codec/cosmos/staking/v1beta1/staking.ts
index 70860217..42ae2497 100644
--- a/src/codec/cosmos/staking/v1beta1/staking.ts
+++ b/src/codec/cosmos/staking/v1beta1/staking.ts
@@ -1,6 +1,6 @@
/* eslint-disable */
import Long from "long";
-import _m0 from "protobufjs/minimal";
+import * as _m0 from "protobufjs/minimal";
import { Header } from "../../../tendermint/types/types";
import { Any } from "../../../google/protobuf/any";
import { Duration } from "../../../google/protobuf/duration";
@@ -294,7 +294,9 @@ export interface Pool {
bondedTokens: string;
}
-const baseHistoricalInfo: object = {};
+function createBaseHistoricalInfo(): HistoricalInfo {
+ return { header: undefined, valset: [] };
+}
export const HistoricalInfo = {
encode(message: HistoricalInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -310,8 +312,7 @@ export const HistoricalInfo = {
decode(input: _m0.Reader | Uint8Array, length?: number): HistoricalInfo {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseHistoricalInfo } as HistoricalInfo;
- message.valset = [];
+ const message = createBaseHistoricalInfo();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -330,19 +331,10 @@ export const HistoricalInfo = {
},
fromJSON(object: any): HistoricalInfo {
- const message = { ...baseHistoricalInfo } as HistoricalInfo;
- message.valset = [];
- if (object.header !== undefined && object.header !== null) {
- message.header = Header.fromJSON(object.header);
- } else {
- message.header = undefined;
- }
- if (object.valset !== undefined && object.valset !== null) {
- for (const e of object.valset) {
- message.valset.push(Validator.fromJSON(e));
- }
- }
- return message;
+ return {
+ header: isSet(object.header) ? Header.fromJSON(object.header) : undefined,
+ valset: Array.isArray(object?.valset) ? object.valset.map((e: any) => Validator.fromJSON(e)) : [],
+ };
},
toJSON(message: HistoricalInfo): unknown {
@@ -356,24 +348,18 @@ export const HistoricalInfo = {
return obj;
},
- fromPartial(object: DeepPartial): HistoricalInfo {
- const message = { ...baseHistoricalInfo } as HistoricalInfo;
- if (object.header !== undefined && object.header !== null) {
- message.header = Header.fromPartial(object.header);
- } else {
- message.header = undefined;
- }
- message.valset = [];
- if (object.valset !== undefined && object.valset !== null) {
- for (const e of object.valset) {
- message.valset.push(Validator.fromPartial(e));
- }
- }
+ fromPartial, I>>(object: I): HistoricalInfo {
+ const message = createBaseHistoricalInfo();
+ message.header =
+ object.header !== undefined && object.header !== null ? Header.fromPartial(object.header) : undefined;
+ message.valset = object.valset?.map((e) => Validator.fromPartial(e)) || [];
return message;
},
};
-const baseCommissionRates: object = { rate: "", maxRate: "", maxChangeRate: "" };
+function createBaseCommissionRates(): CommissionRates {
+ return { rate: "", maxRate: "", maxChangeRate: "" };
+}
export const CommissionRates = {
encode(message: CommissionRates, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -392,7 +378,7 @@ export const CommissionRates = {
decode(input: _m0.Reader | Uint8Array, length?: number): CommissionRates {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseCommissionRates } as CommissionRates;
+ const message = createBaseCommissionRates();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -414,23 +400,11 @@ export const CommissionRates = {
},
fromJSON(object: any): CommissionRates {
- const message = { ...baseCommissionRates } as CommissionRates;
- if (object.rate !== undefined && object.rate !== null) {
- message.rate = String(object.rate);
- } else {
- message.rate = "";
- }
- if (object.maxRate !== undefined && object.maxRate !== null) {
- message.maxRate = String(object.maxRate);
- } else {
- message.maxRate = "";
- }
- if (object.maxChangeRate !== undefined && object.maxChangeRate !== null) {
- message.maxChangeRate = String(object.maxChangeRate);
- } else {
- message.maxChangeRate = "";
- }
- return message;
+ return {
+ rate: isSet(object.rate) ? String(object.rate) : "",
+ maxRate: isSet(object.maxRate) ? String(object.maxRate) : "",
+ maxChangeRate: isSet(object.maxChangeRate) ? String(object.maxChangeRate) : "",
+ };
},
toJSON(message: CommissionRates): unknown {
@@ -441,8 +415,8 @@ export const CommissionRates = {
return obj;
},
- fromPartial(object: DeepPartial): CommissionRates {
- const message = { ...baseCommissionRates } as CommissionRates;
+ fromPartial, I>>(object: I): CommissionRates {
+ const message = createBaseCommissionRates();
message.rate = object.rate ?? "";
message.maxRate = object.maxRate ?? "";
message.maxChangeRate = object.maxChangeRate ?? "";
@@ -450,7 +424,9 @@ export const CommissionRates = {
},
};
-const baseCommission: object = {};
+function createBaseCommission(): Commission {
+ return { commissionRates: undefined, updateTime: undefined };
+}
export const Commission = {
encode(message: Commission, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -466,7 +442,7 @@ export const Commission = {
decode(input: _m0.Reader | Uint8Array, length?: number): Commission {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseCommission } as Commission;
+ const message = createBaseCommission();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -485,18 +461,12 @@ export const Commission = {
},
fromJSON(object: any): Commission {
- const message = { ...baseCommission } as Commission;
- if (object.commissionRates !== undefined && object.commissionRates !== null) {
- message.commissionRates = CommissionRates.fromJSON(object.commissionRates);
- } else {
- message.commissionRates = undefined;
- }
- if (object.updateTime !== undefined && object.updateTime !== null) {
- message.updateTime = fromJsonTimestamp(object.updateTime);
- } else {
- message.updateTime = undefined;
- }
- return message;
+ return {
+ commissionRates: isSet(object.commissionRates)
+ ? CommissionRates.fromJSON(object.commissionRates)
+ : undefined,
+ updateTime: isSet(object.updateTime) ? fromJsonTimestamp(object.updateTime) : undefined,
+ };
},
toJSON(message: Commission): unknown {
@@ -509,19 +479,20 @@ export const Commission = {
return obj;
},
- fromPartial(object: DeepPartial): Commission {
- const message = { ...baseCommission } as Commission;
- if (object.commissionRates !== undefined && object.commissionRates !== null) {
- message.commissionRates = CommissionRates.fromPartial(object.commissionRates);
- } else {
- message.commissionRates = undefined;
- }
+ fromPartial, I>>(object: I): Commission {
+ const message = createBaseCommission();
+ message.commissionRates =
+ object.commissionRates !== undefined && object.commissionRates !== null
+ ? CommissionRates.fromPartial(object.commissionRates)
+ : undefined;
message.updateTime = object.updateTime ?? undefined;
return message;
},
};
-const baseDescription: object = { moniker: "", identity: "", website: "", securityContact: "", details: "" };
+function createBaseDescription(): Description {
+ return { moniker: "", identity: "", website: "", securityContact: "", details: "" };
+}
export const Description = {
encode(message: Description, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -546,7 +517,7 @@ export const Description = {
decode(input: _m0.Reader | Uint8Array, length?: number): Description {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseDescription } as Description;
+ const message = createBaseDescription();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -574,33 +545,13 @@ export const Description = {
},
fromJSON(object: any): Description {
- const message = { ...baseDescription } as Description;
- if (object.moniker !== undefined && object.moniker !== null) {
- message.moniker = String(object.moniker);
- } else {
- message.moniker = "";
- }
- if (object.identity !== undefined && object.identity !== null) {
- message.identity = String(object.identity);
- } else {
- message.identity = "";
- }
- if (object.website !== undefined && object.website !== null) {
- message.website = String(object.website);
- } else {
- message.website = "";
- }
- if (object.securityContact !== undefined && object.securityContact !== null) {
- message.securityContact = String(object.securityContact);
- } else {
- message.securityContact = "";
- }
- if (object.details !== undefined && object.details !== null) {
- message.details = String(object.details);
- } else {
- message.details = "";
- }
- return message;
+ return {
+ moniker: isSet(object.moniker) ? String(object.moniker) : "",
+ identity: isSet(object.identity) ? String(object.identity) : "",
+ website: isSet(object.website) ? String(object.website) : "",
+ securityContact: isSet(object.securityContact) ? String(object.securityContact) : "",
+ details: isSet(object.details) ? String(object.details) : "",
+ };
},
toJSON(message: Description): unknown {
@@ -613,8 +564,8 @@ export const Description = {
return obj;
},
- fromPartial(object: DeepPartial): Description {
- const message = { ...baseDescription } as Description;
+ fromPartial, I>>(object: I): Description {
+ const message = createBaseDescription();
message.moniker = object.moniker ?? "";
message.identity = object.identity ?? "";
message.website = object.website ?? "";
@@ -624,15 +575,21 @@ export const Description = {
},
};
-const baseValidator: object = {
- operatorAddress: "",
- jailed: false,
- status: 0,
- tokens: "",
- delegatorShares: "",
- unbondingHeight: Long.ZERO,
- minSelfDelegation: "",
-};
+function createBaseValidator(): Validator {
+ return {
+ operatorAddress: "",
+ consensusPubkey: undefined,
+ jailed: false,
+ status: 0,
+ tokens: "",
+ delegatorShares: "",
+ description: undefined,
+ unbondingHeight: Long.ZERO,
+ unbondingTime: undefined,
+ commission: undefined,
+ minSelfDelegation: "",
+ };
+}
export const Validator = {
encode(message: Validator, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -675,7 +632,7 @@ export const Validator = {
decode(input: _m0.Reader | Uint8Array, length?: number): Validator {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseValidator } as Validator;
+ const message = createBaseValidator();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -721,63 +678,19 @@ export const Validator = {
},
fromJSON(object: any): Validator {
- const message = { ...baseValidator } as Validator;
- if (object.operatorAddress !== undefined && object.operatorAddress !== null) {
- message.operatorAddress = String(object.operatorAddress);
- } else {
- message.operatorAddress = "";
- }
- if (object.consensusPubkey !== undefined && object.consensusPubkey !== null) {
- message.consensusPubkey = Any.fromJSON(object.consensusPubkey);
- } else {
- message.consensusPubkey = undefined;
- }
- if (object.jailed !== undefined && object.jailed !== null) {
- message.jailed = Boolean(object.jailed);
- } else {
- message.jailed = false;
- }
- if (object.status !== undefined && object.status !== null) {
- message.status = bondStatusFromJSON(object.status);
- } else {
- message.status = 0;
- }
- if (object.tokens !== undefined && object.tokens !== null) {
- message.tokens = String(object.tokens);
- } else {
- message.tokens = "";
- }
- if (object.delegatorShares !== undefined && object.delegatorShares !== null) {
- message.delegatorShares = String(object.delegatorShares);
- } else {
- message.delegatorShares = "";
- }
- if (object.description !== undefined && object.description !== null) {
- message.description = Description.fromJSON(object.description);
- } else {
- message.description = undefined;
- }
- if (object.unbondingHeight !== undefined && object.unbondingHeight !== null) {
- message.unbondingHeight = Long.fromString(object.unbondingHeight);
- } else {
- message.unbondingHeight = Long.ZERO;
- }
- if (object.unbondingTime !== undefined && object.unbondingTime !== null) {
- message.unbondingTime = fromJsonTimestamp(object.unbondingTime);
- } else {
- message.unbondingTime = undefined;
- }
- if (object.commission !== undefined && object.commission !== null) {
- message.commission = Commission.fromJSON(object.commission);
- } else {
- message.commission = undefined;
- }
- if (object.minSelfDelegation !== undefined && object.minSelfDelegation !== null) {
- message.minSelfDelegation = String(object.minSelfDelegation);
- } else {
- message.minSelfDelegation = "";
- }
- return message;
+ return {
+ operatorAddress: isSet(object.operatorAddress) ? String(object.operatorAddress) : "",
+ consensusPubkey: isSet(object.consensusPubkey) ? Any.fromJSON(object.consensusPubkey) : undefined,
+ jailed: isSet(object.jailed) ? Boolean(object.jailed) : false,
+ status: isSet(object.status) ? bondStatusFromJSON(object.status) : 0,
+ tokens: isSet(object.tokens) ? String(object.tokens) : "",
+ delegatorShares: isSet(object.delegatorShares) ? String(object.delegatorShares) : "",
+ description: isSet(object.description) ? Description.fromJSON(object.description) : undefined,
+ unbondingHeight: isSet(object.unbondingHeight) ? Long.fromString(object.unbondingHeight) : Long.ZERO,
+ unbondingTime: isSet(object.unbondingTime) ? fromJsonTimestamp(object.unbondingTime) : undefined,
+ commission: isSet(object.commission) ? Commission.fromJSON(object.commission) : undefined,
+ minSelfDelegation: isSet(object.minSelfDelegation) ? String(object.minSelfDelegation) : "",
+ };
},
toJSON(message: Validator): unknown {
@@ -800,40 +713,38 @@ export const Validator = {
return obj;
},
- fromPartial(object: DeepPartial): Validator {
- const message = { ...baseValidator } as Validator;
+ fromPartial, I>>(object: I): Validator {
+ const message = createBaseValidator();
message.operatorAddress = object.operatorAddress ?? "";
- if (object.consensusPubkey !== undefined && object.consensusPubkey !== null) {
- message.consensusPubkey = Any.fromPartial(object.consensusPubkey);
- } else {
- message.consensusPubkey = undefined;
- }
+ message.consensusPubkey =
+ object.consensusPubkey !== undefined && object.consensusPubkey !== null
+ ? Any.fromPartial(object.consensusPubkey)
+ : undefined;
message.jailed = object.jailed ?? false;
message.status = object.status ?? 0;
message.tokens = object.tokens ?? "";
message.delegatorShares = object.delegatorShares ?? "";
- if (object.description !== undefined && object.description !== null) {
- message.description = Description.fromPartial(object.description);
- } else {
- message.description = undefined;
- }
- if (object.unbondingHeight !== undefined && object.unbondingHeight !== null) {
- message.unbondingHeight = object.unbondingHeight as Long;
- } else {
- message.unbondingHeight = Long.ZERO;
- }
+ message.description =
+ object.description !== undefined && object.description !== null
+ ? Description.fromPartial(object.description)
+ : undefined;
+ message.unbondingHeight =
+ object.unbondingHeight !== undefined && object.unbondingHeight !== null
+ ? Long.fromValue(object.unbondingHeight)
+ : Long.ZERO;
message.unbondingTime = object.unbondingTime ?? undefined;
- if (object.commission !== undefined && object.commission !== null) {
- message.commission = Commission.fromPartial(object.commission);
- } else {
- message.commission = undefined;
- }
+ message.commission =
+ object.commission !== undefined && object.commission !== null
+ ? Commission.fromPartial(object.commission)
+ : undefined;
message.minSelfDelegation = object.minSelfDelegation ?? "";
return message;
},
};
-const baseValAddresses: object = { addresses: "" };
+function createBaseValAddresses(): ValAddresses {
+ return { addresses: [] };
+}
export const ValAddresses = {
encode(message: ValAddresses, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -846,8 +757,7 @@ export const ValAddresses = {
decode(input: _m0.Reader | Uint8Array, length?: number): ValAddresses {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseValAddresses } as ValAddresses;
- message.addresses = [];
+ const message = createBaseValAddresses();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -863,14 +773,9 @@ export const ValAddresses = {
},
fromJSON(object: any): ValAddresses {
- const message = { ...baseValAddresses } as ValAddresses;
- message.addresses = [];
- if (object.addresses !== undefined && object.addresses !== null) {
- for (const e of object.addresses) {
- message.addresses.push(String(e));
- }
- }
- return message;
+ return {
+ addresses: Array.isArray(object?.addresses) ? object.addresses.map((e: any) => String(e)) : [],
+ };
},
toJSON(message: ValAddresses): unknown {
@@ -883,19 +788,16 @@ export const ValAddresses = {
return obj;
},
- fromPartial(object: DeepPartial): ValAddresses {
- const message = { ...baseValAddresses } as ValAddresses;
- message.addresses = [];
- if (object.addresses !== undefined && object.addresses !== null) {
- for (const e of object.addresses) {
- message.addresses.push(e);
- }
- }
+ fromPartial, I>>(object: I): ValAddresses {
+ const message = createBaseValAddresses();
+ message.addresses = object.addresses?.map((e) => e) || [];
return message;
},
};
-const baseDVPair: object = { delegatorAddress: "", validatorAddress: "" };
+function createBaseDVPair(): DVPair {
+ return { delegatorAddress: "", validatorAddress: "" };
+}
export const DVPair = {
encode(message: DVPair, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -911,7 +813,7 @@ export const DVPair = {
decode(input: _m0.Reader | Uint8Array, length?: number): DVPair {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseDVPair } as DVPair;
+ const message = createBaseDVPair();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -930,18 +832,10 @@ export const DVPair = {
},
fromJSON(object: any): DVPair {
- const message = { ...baseDVPair } as DVPair;
- if (object.delegatorAddress !== undefined && object.delegatorAddress !== null) {
- message.delegatorAddress = String(object.delegatorAddress);
- } else {
- message.delegatorAddress = "";
- }
- if (object.validatorAddress !== undefined && object.validatorAddress !== null) {
- message.validatorAddress = String(object.validatorAddress);
- } else {
- message.validatorAddress = "";
- }
- return message;
+ return {
+ delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "",
+ validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "",
+ };
},
toJSON(message: DVPair): unknown {
@@ -951,15 +845,17 @@ export const DVPair = {
return obj;
},
- fromPartial(object: DeepPartial): DVPair {
- const message = { ...baseDVPair } as DVPair;
+ fromPartial, I>>(object: I): DVPair {
+ const message = createBaseDVPair();
message.delegatorAddress = object.delegatorAddress ?? "";
message.validatorAddress = object.validatorAddress ?? "";
return message;
},
};
-const baseDVPairs: object = {};
+function createBaseDVPairs(): DVPairs {
+ return { pairs: [] };
+}
export const DVPairs = {
encode(message: DVPairs, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -972,8 +868,7 @@ export const DVPairs = {
decode(input: _m0.Reader | Uint8Array, length?: number): DVPairs {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseDVPairs } as DVPairs;
- message.pairs = [];
+ const message = createBaseDVPairs();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -989,14 +884,9 @@ export const DVPairs = {
},
fromJSON(object: any): DVPairs {
- const message = { ...baseDVPairs } as DVPairs;
- message.pairs = [];
- if (object.pairs !== undefined && object.pairs !== null) {
- for (const e of object.pairs) {
- message.pairs.push(DVPair.fromJSON(e));
- }
- }
- return message;
+ return {
+ pairs: Array.isArray(object?.pairs) ? object.pairs.map((e: any) => DVPair.fromJSON(e)) : [],
+ };
},
toJSON(message: DVPairs): unknown {
@@ -1009,19 +899,16 @@ export const DVPairs = {
return obj;
},
- fromPartial(object: DeepPartial): DVPairs {
- const message = { ...baseDVPairs } as DVPairs;
- message.pairs = [];
- if (object.pairs !== undefined && object.pairs !== null) {
- for (const e of object.pairs) {
- message.pairs.push(DVPair.fromPartial(e));
- }
- }
+ fromPartial, I>>(object: I): DVPairs {
+ const message = createBaseDVPairs();
+ message.pairs = object.pairs?.map((e) => DVPair.fromPartial(e)) || [];
return message;
},
};
-const baseDVVTriplet: object = { delegatorAddress: "", validatorSrcAddress: "", validatorDstAddress: "" };
+function createBaseDVVTriplet(): DVVTriplet {
+ return { delegatorAddress: "", validatorSrcAddress: "", validatorDstAddress: "" };
+}
export const DVVTriplet = {
encode(message: DVVTriplet, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -1040,7 +927,7 @@ export const DVVTriplet = {
decode(input: _m0.Reader | Uint8Array, length?: number): DVVTriplet {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseDVVTriplet } as DVVTriplet;
+ const message = createBaseDVVTriplet();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -1062,23 +949,11 @@ export const DVVTriplet = {
},
fromJSON(object: any): DVVTriplet {
- const message = { ...baseDVVTriplet } as DVVTriplet;
- if (object.delegatorAddress !== undefined && object.delegatorAddress !== null) {
- message.delegatorAddress = String(object.delegatorAddress);
- } else {
- message.delegatorAddress = "";
- }
- if (object.validatorSrcAddress !== undefined && object.validatorSrcAddress !== null) {
- message.validatorSrcAddress = String(object.validatorSrcAddress);
- } else {
- message.validatorSrcAddress = "";
- }
- if (object.validatorDstAddress !== undefined && object.validatorDstAddress !== null) {
- message.validatorDstAddress = String(object.validatorDstAddress);
- } else {
- message.validatorDstAddress = "";
- }
- return message;
+ return {
+ delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "",
+ validatorSrcAddress: isSet(object.validatorSrcAddress) ? String(object.validatorSrcAddress) : "",
+ validatorDstAddress: isSet(object.validatorDstAddress) ? String(object.validatorDstAddress) : "",
+ };
},
toJSON(message: DVVTriplet): unknown {
@@ -1089,8 +964,8 @@ export const DVVTriplet = {
return obj;
},
- fromPartial(object: DeepPartial): DVVTriplet {
- const message = { ...baseDVVTriplet } as DVVTriplet;
+ fromPartial, I>>(object: I): DVVTriplet {
+ const message = createBaseDVVTriplet();
message.delegatorAddress = object.delegatorAddress ?? "";
message.validatorSrcAddress = object.validatorSrcAddress ?? "";
message.validatorDstAddress = object.validatorDstAddress ?? "";
@@ -1098,7 +973,9 @@ export const DVVTriplet = {
},
};
-const baseDVVTriplets: object = {};
+function createBaseDVVTriplets(): DVVTriplets {
+ return { triplets: [] };
+}
export const DVVTriplets = {
encode(message: DVVTriplets, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -1111,8 +988,7 @@ export const DVVTriplets = {
decode(input: _m0.Reader | Uint8Array, length?: number): DVVTriplets {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseDVVTriplets } as DVVTriplets;
- message.triplets = [];
+ const message = createBaseDVVTriplets();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -1128,14 +1004,11 @@ export const DVVTriplets = {
},
fromJSON(object: any): DVVTriplets {
- const message = { ...baseDVVTriplets } as DVVTriplets;
- message.triplets = [];
- if (object.triplets !== undefined && object.triplets !== null) {
- for (const e of object.triplets) {
- message.triplets.push(DVVTriplet.fromJSON(e));
- }
- }
- return message;
+ return {
+ triplets: Array.isArray(object?.triplets)
+ ? object.triplets.map((e: any) => DVVTriplet.fromJSON(e))
+ : [],
+ };
},
toJSON(message: DVVTriplets): unknown {
@@ -1148,19 +1021,16 @@ export const DVVTriplets = {
return obj;
},
- fromPartial(object: DeepPartial): DVVTriplets {
- const message = { ...baseDVVTriplets } as DVVTriplets;
- message.triplets = [];
- if (object.triplets !== undefined && object.triplets !== null) {
- for (const e of object.triplets) {
- message.triplets.push(DVVTriplet.fromPartial(e));
- }
- }
+ fromPartial, I>>(object: I): DVVTriplets {
+ const message = createBaseDVVTriplets();
+ message.triplets = object.triplets?.map((e) => DVVTriplet.fromPartial(e)) || [];
return message;
},
};
-const baseDelegation: object = { delegatorAddress: "", validatorAddress: "", shares: "" };
+function createBaseDelegation(): Delegation {
+ return { delegatorAddress: "", validatorAddress: "", shares: "" };
+}
export const Delegation = {
encode(message: Delegation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -1179,7 +1049,7 @@ export const Delegation = {
decode(input: _m0.Reader | Uint8Array, length?: number): Delegation {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseDelegation } as Delegation;
+ const message = createBaseDelegation();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -1201,23 +1071,11 @@ export const Delegation = {
},
fromJSON(object: any): Delegation {
- const message = { ...baseDelegation } as Delegation;
- if (object.delegatorAddress !== undefined && object.delegatorAddress !== null) {
- message.delegatorAddress = String(object.delegatorAddress);
- } else {
- message.delegatorAddress = "";
- }
- if (object.validatorAddress !== undefined && object.validatorAddress !== null) {
- message.validatorAddress = String(object.validatorAddress);
- } else {
- message.validatorAddress = "";
- }
- if (object.shares !== undefined && object.shares !== null) {
- message.shares = String(object.shares);
- } else {
- message.shares = "";
- }
- return message;
+ return {
+ delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "",
+ validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "",
+ shares: isSet(object.shares) ? String(object.shares) : "",
+ };
},
toJSON(message: Delegation): unknown {
@@ -1228,8 +1086,8 @@ export const Delegation = {
return obj;
},
- fromPartial(object: DeepPartial): Delegation {
- const message = { ...baseDelegation } as Delegation;
+ fromPartial, I>>(object: I): Delegation {
+ const message = createBaseDelegation();
message.delegatorAddress = object.delegatorAddress ?? "";
message.validatorAddress = object.validatorAddress ?? "";
message.shares = object.shares ?? "";
@@ -1237,7 +1095,9 @@ export const Delegation = {
},
};
-const baseUnbondingDelegation: object = { delegatorAddress: "", validatorAddress: "" };
+function createBaseUnbondingDelegation(): UnbondingDelegation {
+ return { delegatorAddress: "", validatorAddress: "", entries: [] };
+}
export const UnbondingDelegation = {
encode(message: UnbondingDelegation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -1256,8 +1116,7 @@ export const UnbondingDelegation = {
decode(input: _m0.Reader | Uint8Array, length?: number): UnbondingDelegation {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseUnbondingDelegation } as UnbondingDelegation;
- message.entries = [];
+ const message = createBaseUnbondingDelegation();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -1279,24 +1138,13 @@ export const UnbondingDelegation = {
},
fromJSON(object: any): UnbondingDelegation {
- const message = { ...baseUnbondingDelegation } as UnbondingDelegation;
- message.entries = [];
- if (object.delegatorAddress !== undefined && object.delegatorAddress !== null) {
- message.delegatorAddress = String(object.delegatorAddress);
- } else {
- message.delegatorAddress = "";
- }
- if (object.validatorAddress !== undefined && object.validatorAddress !== null) {
- message.validatorAddress = String(object.validatorAddress);
- } else {
- message.validatorAddress = "";
- }
- if (object.entries !== undefined && object.entries !== null) {
- for (const e of object.entries) {
- message.entries.push(UnbondingDelegationEntry.fromJSON(e));
- }
- }
- return message;
+ return {
+ delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "",
+ validatorAddress: isSet(object.validatorAddress) ? String(object.validatorAddress) : "",
+ entries: Array.isArray(object?.entries)
+ ? object.entries.map((e: any) => UnbondingDelegationEntry.fromJSON(e))
+ : [],
+ };
},
toJSON(message: UnbondingDelegation): unknown {
@@ -1311,21 +1159,18 @@ export const UnbondingDelegation = {
return obj;
},
- fromPartial(object: DeepPartial): UnbondingDelegation {
- const message = { ...baseUnbondingDelegation } as UnbondingDelegation;
+ fromPartial, I>>(object: I): UnbondingDelegation {
+ const message = createBaseUnbondingDelegation();
message.delegatorAddress = object.delegatorAddress ?? "";
message.validatorAddress = object.validatorAddress ?? "";
- message.entries = [];
- if (object.entries !== undefined && object.entries !== null) {
- for (const e of object.entries) {
- message.entries.push(UnbondingDelegationEntry.fromPartial(e));
- }
- }
+ message.entries = object.entries?.map((e) => UnbondingDelegationEntry.fromPartial(e)) || [];
return message;
},
};
-const baseUnbondingDelegationEntry: object = { creationHeight: Long.ZERO, initialBalance: "", balance: "" };
+function createBaseUnbondingDelegationEntry(): UnbondingDelegationEntry {
+ return { creationHeight: Long.ZERO, completionTime: undefined, initialBalance: "", balance: "" };
+}
export const UnbondingDelegationEntry = {
encode(message: UnbondingDelegationEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -1347,7 +1192,7 @@ export const UnbondingDelegationEntry = {
decode(input: _m0.Reader | Uint8Array, length?: number): UnbondingDelegationEntry {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseUnbondingDelegationEntry } as UnbondingDelegationEntry;
+ const message = createBaseUnbondingDelegationEntry();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -1372,28 +1217,12 @@ export const UnbondingDelegationEntry = {
},
fromJSON(object: any): UnbondingDelegationEntry {
- const message = { ...baseUnbondingDelegationEntry } as UnbondingDelegationEntry;
- if (object.creationHeight !== undefined && object.creationHeight !== null) {
- message.creationHeight = Long.fromString(object.creationHeight);
- } else {
- message.creationHeight = Long.ZERO;
- }
- if (object.completionTime !== undefined && object.completionTime !== null) {
- message.completionTime = fromJsonTimestamp(object.completionTime);
- } else {
- message.completionTime = undefined;
- }
- if (object.initialBalance !== undefined && object.initialBalance !== null) {
- message.initialBalance = String(object.initialBalance);
- } else {
- message.initialBalance = "";
- }
- if (object.balance !== undefined && object.balance !== null) {
- message.balance = String(object.balance);
- } else {
- message.balance = "";
- }
- return message;
+ return {
+ creationHeight: isSet(object.creationHeight) ? Long.fromString(object.creationHeight) : Long.ZERO,
+ completionTime: isSet(object.completionTime) ? fromJsonTimestamp(object.completionTime) : undefined,
+ initialBalance: isSet(object.initialBalance) ? String(object.initialBalance) : "",
+ balance: isSet(object.balance) ? String(object.balance) : "",
+ };
},
toJSON(message: UnbondingDelegationEntry): unknown {
@@ -1406,13 +1235,14 @@ export const UnbondingDelegationEntry = {
return obj;
},
- fromPartial(object: DeepPartial): UnbondingDelegationEntry {
- const message = { ...baseUnbondingDelegationEntry } as UnbondingDelegationEntry;
- if (object.creationHeight !== undefined && object.creationHeight !== null) {
- message.creationHeight = object.creationHeight as Long;
- } else {
- message.creationHeight = Long.ZERO;
- }
+ fromPartial, I>>(
+ object: I,
+ ): UnbondingDelegationEntry {
+ const message = createBaseUnbondingDelegationEntry();
+ message.creationHeight =
+ object.creationHeight !== undefined && object.creationHeight !== null
+ ? Long.fromValue(object.creationHeight)
+ : Long.ZERO;
message.completionTime = object.completionTime ?? undefined;
message.initialBalance = object.initialBalance ?? "";
message.balance = object.balance ?? "";
@@ -1420,7 +1250,9 @@ export const UnbondingDelegationEntry = {
},
};
-const baseRedelegationEntry: object = { creationHeight: Long.ZERO, initialBalance: "", sharesDst: "" };
+function createBaseRedelegationEntry(): RedelegationEntry {
+ return { creationHeight: Long.ZERO, completionTime: undefined, initialBalance: "", sharesDst: "" };
+}
export const RedelegationEntry = {
encode(message: RedelegationEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -1442,7 +1274,7 @@ export const RedelegationEntry = {
decode(input: _m0.Reader | Uint8Array, length?: number): RedelegationEntry {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseRedelegationEntry } as RedelegationEntry;
+ const message = createBaseRedelegationEntry();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -1467,28 +1299,12 @@ export const RedelegationEntry = {
},
fromJSON(object: any): RedelegationEntry {
- const message = { ...baseRedelegationEntry } as RedelegationEntry;
- if (object.creationHeight !== undefined && object.creationHeight !== null) {
- message.creationHeight = Long.fromString(object.creationHeight);
- } else {
- message.creationHeight = Long.ZERO;
- }
- if (object.completionTime !== undefined && object.completionTime !== null) {
- message.completionTime = fromJsonTimestamp(object.completionTime);
- } else {
- message.completionTime = undefined;
- }
- if (object.initialBalance !== undefined && object.initialBalance !== null) {
- message.initialBalance = String(object.initialBalance);
- } else {
- message.initialBalance = "";
- }
- if (object.sharesDst !== undefined && object.sharesDst !== null) {
- message.sharesDst = String(object.sharesDst);
- } else {
- message.sharesDst = "";
- }
- return message;
+ return {
+ creationHeight: isSet(object.creationHeight) ? Long.fromString(object.creationHeight) : Long.ZERO,
+ completionTime: isSet(object.completionTime) ? fromJsonTimestamp(object.completionTime) : undefined,
+ initialBalance: isSet(object.initialBalance) ? String(object.initialBalance) : "",
+ sharesDst: isSet(object.sharesDst) ? String(object.sharesDst) : "",
+ };
},
toJSON(message: RedelegationEntry): unknown {
@@ -1501,13 +1317,12 @@ export const RedelegationEntry = {
return obj;
},
- fromPartial(object: DeepPartial): RedelegationEntry {
- const message = { ...baseRedelegationEntry } as RedelegationEntry;
- if (object.creationHeight !== undefined && object.creationHeight !== null) {
- message.creationHeight = object.creationHeight as Long;
- } else {
- message.creationHeight = Long.ZERO;
- }
+ fromPartial, I>>(object: I): RedelegationEntry {
+ const message = createBaseRedelegationEntry();
+ message.creationHeight =
+ object.creationHeight !== undefined && object.creationHeight !== null
+ ? Long.fromValue(object.creationHeight)
+ : Long.ZERO;
message.completionTime = object.completionTime ?? undefined;
message.initialBalance = object.initialBalance ?? "";
message.sharesDst = object.sharesDst ?? "";
@@ -1515,7 +1330,9 @@ export const RedelegationEntry = {
},
};
-const baseRedelegation: object = { delegatorAddress: "", validatorSrcAddress: "", validatorDstAddress: "" };
+function createBaseRedelegation(): Redelegation {
+ return { delegatorAddress: "", validatorSrcAddress: "", validatorDstAddress: "", entries: [] };
+}
export const Redelegation = {
encode(message: Redelegation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -1537,8 +1354,7 @@ export const Redelegation = {
decode(input: _m0.Reader | Uint8Array, length?: number): Redelegation {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseRedelegation } as Redelegation;
- message.entries = [];
+ const message = createBaseRedelegation();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -1563,29 +1379,14 @@ export const Redelegation = {
},
fromJSON(object: any): Redelegation {
- const message = { ...baseRedelegation } as Redelegation;
- message.entries = [];
- if (object.delegatorAddress !== undefined && object.delegatorAddress !== null) {
- message.delegatorAddress = String(object.delegatorAddress);
- } else {
- message.delegatorAddress = "";
- }
- if (object.validatorSrcAddress !== undefined && object.validatorSrcAddress !== null) {
- message.validatorSrcAddress = String(object.validatorSrcAddress);
- } else {
- message.validatorSrcAddress = "";
- }
- if (object.validatorDstAddress !== undefined && object.validatorDstAddress !== null) {
- message.validatorDstAddress = String(object.validatorDstAddress);
- } else {
- message.validatorDstAddress = "";
- }
- if (object.entries !== undefined && object.entries !== null) {
- for (const e of object.entries) {
- message.entries.push(RedelegationEntry.fromJSON(e));
- }
- }
- return message;
+ return {
+ delegatorAddress: isSet(object.delegatorAddress) ? String(object.delegatorAddress) : "",
+ validatorSrcAddress: isSet(object.validatorSrcAddress) ? String(object.validatorSrcAddress) : "",
+ validatorDstAddress: isSet(object.validatorDstAddress) ? String(object.validatorDstAddress) : "",
+ entries: Array.isArray(object?.entries)
+ ? object.entries.map((e: any) => RedelegationEntry.fromJSON(e))
+ : [],
+ };
},
toJSON(message: Redelegation): unknown {
@@ -1601,22 +1402,19 @@ export const Redelegation = {
return obj;
},
- fromPartial(object: DeepPartial): Redelegation {
- const message = { ...baseRedelegation } as Redelegation;
+ fromPartial, I>>(object: I): Redelegation {
+ const message = createBaseRedelegation();
message.delegatorAddress = object.delegatorAddress ?? "";
message.validatorSrcAddress = object.validatorSrcAddress ?? "";
message.validatorDstAddress = object.validatorDstAddress ?? "";
- message.entries = [];
- if (object.entries !== undefined && object.entries !== null) {
- for (const e of object.entries) {
- message.entries.push(RedelegationEntry.fromPartial(e));
- }
- }
+ message.entries = object.entries?.map((e) => RedelegationEntry.fromPartial(e)) || [];
return message;
},
};
-const baseParams: object = { maxValidators: 0, maxEntries: 0, historicalEntries: 0, bondDenom: "" };
+function createBaseParams(): Params {
+ return { unbondingTime: undefined, maxValidators: 0, maxEntries: 0, historicalEntries: 0, bondDenom: "" };
+}
export const Params = {
encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -1641,7 +1439,7 @@ export const Params = {
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 = { ...baseParams } as Params;
+ const message = createBaseParams();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -1669,53 +1467,33 @@ export const Params = {
},
fromJSON(object: any): Params {
- const message = { ...baseParams } as Params;
- if (object.unbondingTime !== undefined && object.unbondingTime !== null) {
- message.unbondingTime = Duration.fromJSON(object.unbondingTime);
- } else {
- message.unbondingTime = undefined;
- }
- if (object.maxValidators !== undefined && object.maxValidators !== null) {
- message.maxValidators = Number(object.maxValidators);
- } else {
- message.maxValidators = 0;
- }
- if (object.maxEntries !== undefined && object.maxEntries !== null) {
- message.maxEntries = Number(object.maxEntries);
- } else {
- message.maxEntries = 0;
- }
- if (object.historicalEntries !== undefined && object.historicalEntries !== null) {
- message.historicalEntries = Number(object.historicalEntries);
- } else {
- message.historicalEntries = 0;
- }
- if (object.bondDenom !== undefined && object.bondDenom !== null) {
- message.bondDenom = String(object.bondDenom);
- } else {
- message.bondDenom = "";
- }
- return message;
+ return {
+ unbondingTime: isSet(object.unbondingTime) ? Duration.fromJSON(object.unbondingTime) : undefined,
+ maxValidators: isSet(object.maxValidators) ? Number(object.maxValidators) : 0,
+ maxEntries: isSet(object.maxEntries) ? Number(object.maxEntries) : 0,
+ historicalEntries: isSet(object.historicalEntries) ? Number(object.historicalEntries) : 0,
+ bondDenom: isSet(object.bondDenom) ? String(object.bondDenom) : "",
+ };
},
toJSON(message: Params): unknown {
const obj: any = {};
message.unbondingTime !== undefined &&
(obj.unbondingTime = message.unbondingTime ? Duration.toJSON(message.unbondingTime) : undefined);
- message.maxValidators !== undefined && (obj.maxValidators = message.maxValidators);
- message.maxEntries !== undefined && (obj.maxEntries = message.maxEntries);
- message.historicalEntries !== undefined && (obj.historicalEntries = message.historicalEntries);
+ message.maxValidators !== undefined && (obj.maxValidators = Math.round(message.maxValidators));
+ message.maxEntries !== undefined && (obj.maxEntries = Math.round(message.maxEntries));
+ message.historicalEntries !== undefined &&
+ (obj.historicalEntries = Math.round(message.historicalEntries));
message.bondDenom !== undefined && (obj.bondDenom = message.bondDenom);
return obj;
},
- fromPartial(object: DeepPartial): Params {
- const message = { ...baseParams } as Params;
- if (object.unbondingTime !== undefined && object.unbondingTime !== null) {
- message.unbondingTime = Duration.fromPartial(object.unbondingTime);
- } else {
- message.unbondingTime = undefined;
- }
+ fromPartial, I>>(object: I): Params {
+ const message = createBaseParams();
+ message.unbondingTime =
+ object.unbondingTime !== undefined && object.unbondingTime !== null
+ ? Duration.fromPartial(object.unbondingTime)
+ : undefined;
message.maxValidators = object.maxValidators ?? 0;
message.maxEntries = object.maxEntries ?? 0;
message.historicalEntries = object.historicalEntries ?? 0;
@@ -1724,7 +1502,9 @@ export const Params = {
},
};
-const baseDelegationResponse: object = {};
+function createBaseDelegationResponse(): DelegationResponse {
+ return { delegation: undefined, balance: undefined };
+}
export const DelegationResponse = {
encode(message: DelegationResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -1740,7 +1520,7 @@ export const DelegationResponse = {
decode(input: _m0.Reader | Uint8Array, length?: number): DelegationResponse {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseDelegationResponse } as DelegationResponse;
+ const message = createBaseDelegationResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -1759,18 +1539,10 @@ export const DelegationResponse = {
},
fromJSON(object: any): DelegationResponse {
- const message = { ...baseDelegationResponse } as DelegationResponse;
- if (object.delegation !== undefined && object.delegation !== null) {
- message.delegation = Delegation.fromJSON(object.delegation);
- } else {
- message.delegation = undefined;
- }
- if (object.balance !== undefined && object.balance !== null) {
- message.balance = Coin.fromJSON(object.balance);
- } else {
- message.balance = undefined;
- }
- return message;
+ return {
+ delegation: isSet(object.delegation) ? Delegation.fromJSON(object.delegation) : undefined,
+ balance: isSet(object.balance) ? Coin.fromJSON(object.balance) : undefined,
+ };
},
toJSON(message: DelegationResponse): unknown {
@@ -1782,23 +1554,21 @@ export const DelegationResponse = {
return obj;
},
- fromPartial(object: DeepPartial): DelegationResponse {
- const message = { ...baseDelegationResponse } as DelegationResponse;
- if (object.delegation !== undefined && object.delegation !== null) {
- message.delegation = Delegation.fromPartial(object.delegation);
- } else {
- message.delegation = undefined;
- }
- if (object.balance !== undefined && object.balance !== null) {
- message.balance = Coin.fromPartial(object.balance);
- } else {
- message.balance = undefined;
- }
+ fromPartial, I>>(object: I): DelegationResponse {
+ const message = createBaseDelegationResponse();
+ message.delegation =
+ object.delegation !== undefined && object.delegation !== null
+ ? Delegation.fromPartial(object.delegation)
+ : undefined;
+ message.balance =
+ object.balance !== undefined && object.balance !== null ? Coin.fromPartial(object.balance) : undefined;
return message;
},
};
-const baseRedelegationEntryResponse: object = { balance: "" };
+function createBaseRedelegationEntryResponse(): RedelegationEntryResponse {
+ return { redelegationEntry: undefined, balance: "" };
+}
export const RedelegationEntryResponse = {
encode(message: RedelegationEntryResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -1814,7 +1584,7 @@ export const RedelegationEntryResponse = {
decode(input: _m0.Reader | Uint8Array, length?: number): RedelegationEntryResponse {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseRedelegationEntryResponse } as RedelegationEntryResponse;
+ const message = createBaseRedelegationEntryResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -1833,18 +1603,12 @@ export const RedelegationEntryResponse = {
},
fromJSON(object: any): RedelegationEntryResponse {
- const message = { ...baseRedelegationEntryResponse } as RedelegationEntryResponse;
- if (object.redelegationEntry !== undefined && object.redelegationEntry !== null) {
- message.redelegationEntry = RedelegationEntry.fromJSON(object.redelegationEntry);
- } else {
- message.redelegationEntry = undefined;
- }
- if (object.balance !== undefined && object.balance !== null) {
- message.balance = String(object.balance);
- } else {
- message.balance = "";
- }
- return message;
+ return {
+ redelegationEntry: isSet(object.redelegationEntry)
+ ? RedelegationEntry.fromJSON(object.redelegationEntry)
+ : undefined,
+ balance: isSet(object.balance) ? String(object.balance) : "",
+ };
},
toJSON(message: RedelegationEntryResponse): unknown {
@@ -1857,19 +1621,22 @@ export const RedelegationEntryResponse = {
return obj;
},
- fromPartial(object: DeepPartial): RedelegationEntryResponse {
- const message = { ...baseRedelegationEntryResponse } as RedelegationEntryResponse;
- if (object.redelegationEntry !== undefined && object.redelegationEntry !== null) {
- message.redelegationEntry = RedelegationEntry.fromPartial(object.redelegationEntry);
- } else {
- message.redelegationEntry = undefined;
- }
+ fromPartial, I>>(
+ object: I,
+ ): RedelegationEntryResponse {
+ const message = createBaseRedelegationEntryResponse();
+ message.redelegationEntry =
+ object.redelegationEntry !== undefined && object.redelegationEntry !== null
+ ? RedelegationEntry.fromPartial(object.redelegationEntry)
+ : undefined;
message.balance = object.balance ?? "";
return message;
},
};
-const baseRedelegationResponse: object = {};
+function createBaseRedelegationResponse(): RedelegationResponse {
+ return { redelegation: undefined, entries: [] };
+}
export const RedelegationResponse = {
encode(message: RedelegationResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -1885,8 +1652,7 @@ export const RedelegationResponse = {
decode(input: _m0.Reader | Uint8Array, length?: number): RedelegationResponse {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseRedelegationResponse } as RedelegationResponse;
- message.entries = [];
+ const message = createBaseRedelegationResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -1905,19 +1671,12 @@ export const RedelegationResponse = {
},
fromJSON(object: any): RedelegationResponse {
- const message = { ...baseRedelegationResponse } as RedelegationResponse;
- message.entries = [];
- if (object.redelegation !== undefined && object.redelegation !== null) {
- message.redelegation = Redelegation.fromJSON(object.redelegation);
- } else {
- message.redelegation = undefined;
- }
- if (object.entries !== undefined && object.entries !== null) {
- for (const e of object.entries) {
- message.entries.push(RedelegationEntryResponse.fromJSON(e));
- }
- }
- return message;
+ return {
+ redelegation: isSet(object.redelegation) ? Redelegation.fromJSON(object.redelegation) : undefined,
+ entries: Array.isArray(object?.entries)
+ ? object.entries.map((e: any) => RedelegationEntryResponse.fromJSON(e))
+ : [],
+ };
},
toJSON(message: RedelegationResponse): unknown {
@@ -1932,24 +1691,20 @@ export const RedelegationResponse = {
return obj;
},
- fromPartial(object: DeepPartial): RedelegationResponse {
- const message = { ...baseRedelegationResponse } as RedelegationResponse;
- if (object.redelegation !== undefined && object.redelegation !== null) {
- message.redelegation = Redelegation.fromPartial(object.redelegation);
- } else {
- message.redelegation = undefined;
- }
- message.entries = [];
- if (object.entries !== undefined && object.entries !== null) {
- for (const e of object.entries) {
- message.entries.push(RedelegationEntryResponse.fromPartial(e));
- }
- }
+ fromPartial, I>>(object: I): RedelegationResponse {
+ const message = createBaseRedelegationResponse();
+ message.redelegation =
+ object.redelegation !== undefined && object.redelegation !== null
+ ? Redelegation.fromPartial(object.redelegation)
+ : undefined;
+ message.entries = object.entries?.map((e) => RedelegationEntryResponse.fromPartial(e)) || [];
return message;
},
};
-const basePool: object = { notBondedTokens: "", bondedTokens: "" };
+function createBasePool(): Pool {
+ return { notBondedTokens: "", bondedTokens: "" };
+}
export const Pool = {
encode(message: Pool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -1965,7 +1720,7 @@ export const Pool = {
decode(input: _m0.Reader | Uint8Array, length?: number): Pool {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...basePool } as Pool;
+ const message = createBasePool();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -1984,18 +1739,10 @@ export const Pool = {
},
fromJSON(object: any): Pool {
- const message = { ...basePool } as Pool;
- if (object.notBondedTokens !== undefined && object.notBondedTokens !== null) {
- message.notBondedTokens = String(object.notBondedTokens);
- } else {
- message.notBondedTokens = "";
- }
- if (object.bondedTokens !== undefined && object.bondedTokens !== null) {
- message.bondedTokens = String(object.bondedTokens);
- } else {
- message.bondedTokens = "";
- }
- return message;
+ return {
+ notBondedTokens: isSet(object.notBondedTokens) ? String(object.notBondedTokens) : "",
+ bondedTokens: isSet(object.bondedTokens) ? String(object.bondedTokens) : "",
+ };
},
toJSON(message: Pool): unknown {
@@ -2005,17 +1752,20 @@ export const Pool = {
return obj;
},
- fromPartial(object: DeepPartial): Pool {
- const message = { ...basePool } as Pool;
+ fromPartial, I>>(object: I): Pool {
+ const message = createBasePool();
message.notBondedTokens = object.notBondedTokens ?? "";
message.bondedTokens = object.bondedTokens ?? "";
return message;
},
};
-type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined | Long;
+type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
+
export type DeepPartial = T extends Builtin
? T
+ : T extends Long
+ ? string | number | Long
: T extends Array
? Array>
: T extends ReadonlyArray
@@ -2024,6 +1774,11 @@ export type DeepPartial = T extends Builtin
? { [K in keyof T]?: DeepPartial }
: Partial;
+type KeysOfUnion = T extends T ? keyof T : never;
+export type Exact = P extends Builtin
+ ? P
+ : P & { [K in keyof P]: Exact
} & Record>, never>;
+
function toTimestamp(date: Date): Timestamp {
const seconds = numberToLong(date.getTime() / 1_000);
const nanos = (date.getTime() % 1_000) * 1_000_000;
@@ -2054,3 +1809,7 @@ if (_m0.util.Long !== Long) {
_m0.util.Long = Long as any;
_m0.configure();
}
+
+function isSet(value: any): boolean {
+ return value !== null && value !== undefined;
+}
diff --git a/src/codec/cosmos_proto/cosmos.ts b/src/codec/cosmos_proto/cosmos.ts
index be41366a..4c2f49d0 100644
--- a/src/codec/cosmos_proto/cosmos.ts
+++ b/src/codec/cosmos_proto/cosmos.ts
@@ -1,6 +1,6 @@
/* eslint-disable */
import Long from "long";
-import _m0 from "protobufjs/minimal";
+import * as _m0 from "protobufjs/minimal";
export const protobufPackage = "cosmos_proto";
diff --git a/src/codec/gogoproto/gogo.ts b/src/codec/gogoproto/gogo.ts
index 2f8cdcc0..2d66a277 100644
--- a/src/codec/gogoproto/gogo.ts
+++ b/src/codec/gogoproto/gogo.ts
@@ -1,6 +1,6 @@
/* eslint-disable */
import Long from "long";
-import _m0 from "protobufjs/minimal";
+import * as _m0 from "protobufjs/minimal";
export const protobufPackage = "gogoproto";
diff --git a/src/codec/google/api/annotations.ts b/src/codec/google/api/annotations.ts
index b0b6729f..6e6ca014 100644
--- a/src/codec/google/api/annotations.ts
+++ b/src/codec/google/api/annotations.ts
@@ -1,6 +1,6 @@
/* eslint-disable */
import Long from "long";
-import _m0 from "protobufjs/minimal";
+import * as _m0 from "protobufjs/minimal";
export const protobufPackage = "google.api";
diff --git a/src/codec/google/api/http.ts b/src/codec/google/api/http.ts
index b85361de..7254f666 100644
--- a/src/codec/google/api/http.ts
+++ b/src/codec/google/api/http.ts
@@ -1,6 +1,6 @@
/* eslint-disable */
import Long from "long";
-import _m0 from "protobufjs/minimal";
+import * as _m0 from "protobufjs/minimal";
export const protobufPackage = "google.api";
@@ -299,7 +299,9 @@ export interface CustomHttpPattern {
path: string;
}
-const baseHttp: object = { fullyDecodeReservedExpansion: false };
+function createBaseHttp(): Http {
+ return { rules: [], fullyDecodeReservedExpansion: false };
+}
export const Http = {
encode(message: Http, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -315,8 +317,7 @@ export const Http = {
decode(input: _m0.Reader | Uint8Array, length?: number): Http {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseHttp } as Http;
- message.rules = [];
+ const message = createBaseHttp();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -335,19 +336,12 @@ export const Http = {
},
fromJSON(object: any): Http {
- const message = { ...baseHttp } as Http;
- message.rules = [];
- if (object.rules !== undefined && object.rules !== null) {
- for (const e of object.rules) {
- message.rules.push(HttpRule.fromJSON(e));
- }
- }
- if (object.fullyDecodeReservedExpansion !== undefined && object.fullyDecodeReservedExpansion !== null) {
- message.fullyDecodeReservedExpansion = Boolean(object.fullyDecodeReservedExpansion);
- } else {
- message.fullyDecodeReservedExpansion = false;
- }
- return message;
+ return {
+ rules: Array.isArray(object?.rules) ? object.rules.map((e: any) => HttpRule.fromJSON(e)) : [],
+ fullyDecodeReservedExpansion: isSet(object.fullyDecodeReservedExpansion)
+ ? Boolean(object.fullyDecodeReservedExpansion)
+ : false,
+ };
},
toJSON(message: Http): unknown {
@@ -362,20 +356,28 @@ export const Http = {
return obj;
},
- fromPartial(object: DeepPartial): Http {
- const message = { ...baseHttp } as Http;
- message.rules = [];
- if (object.rules !== undefined && object.rules !== null) {
- for (const e of object.rules) {
- message.rules.push(HttpRule.fromPartial(e));
- }
- }
+ fromPartial, I>>(object: I): Http {
+ const message = createBaseHttp();
+ message.rules = object.rules?.map((e) => HttpRule.fromPartial(e)) || [];
message.fullyDecodeReservedExpansion = object.fullyDecodeReservedExpansion ?? false;
return message;
},
};
-const baseHttpRule: object = { selector: "", body: "", responseBody: "" };
+function createBaseHttpRule(): HttpRule {
+ return {
+ selector: "",
+ get: undefined,
+ put: undefined,
+ post: undefined,
+ delete: undefined,
+ patch: undefined,
+ custom: undefined,
+ body: "",
+ responseBody: "",
+ additionalBindings: [],
+ };
+}
export const HttpRule = {
encode(message: HttpRule, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -415,8 +417,7 @@ export const HttpRule = {
decode(input: _m0.Reader | Uint8Array, length?: number): HttpRule {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseHttpRule } as HttpRule;
- message.additionalBindings = [];
+ const message = createBaseHttpRule();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -459,59 +460,20 @@ export const HttpRule = {
},
fromJSON(object: any): HttpRule {
- const message = { ...baseHttpRule } as HttpRule;
- message.additionalBindings = [];
- if (object.selector !== undefined && object.selector !== null) {
- message.selector = String(object.selector);
- } else {
- message.selector = "";
- }
- if (object.get !== undefined && object.get !== null) {
- message.get = String(object.get);
- } else {
- message.get = undefined;
- }
- if (object.put !== undefined && object.put !== null) {
- message.put = String(object.put);
- } else {
- message.put = undefined;
- }
- if (object.post !== undefined && object.post !== null) {
- message.post = String(object.post);
- } else {
- message.post = undefined;
- }
- if (object.delete !== undefined && object.delete !== null) {
- message.delete = String(object.delete);
- } else {
- message.delete = undefined;
- }
- if (object.patch !== undefined && object.patch !== null) {
- message.patch = String(object.patch);
- } else {
- message.patch = undefined;
- }
- if (object.custom !== undefined && object.custom !== null) {
- message.custom = CustomHttpPattern.fromJSON(object.custom);
- } else {
- message.custom = undefined;
- }
- if (object.body !== undefined && object.body !== null) {
- message.body = String(object.body);
- } else {
- message.body = "";
- }
- if (object.responseBody !== undefined && object.responseBody !== null) {
- message.responseBody = String(object.responseBody);
- } else {
- message.responseBody = "";
- }
- if (object.additionalBindings !== undefined && object.additionalBindings !== null) {
- for (const e of object.additionalBindings) {
- message.additionalBindings.push(HttpRule.fromJSON(e));
- }
- }
- return message;
+ return {
+ selector: isSet(object.selector) ? String(object.selector) : "",
+ get: isSet(object.get) ? String(object.get) : undefined,
+ put: isSet(object.put) ? String(object.put) : undefined,
+ post: isSet(object.post) ? String(object.post) : undefined,
+ delete: isSet(object.delete) ? String(object.delete) : undefined,
+ patch: isSet(object.patch) ? String(object.patch) : undefined,
+ custom: isSet(object.custom) ? CustomHttpPattern.fromJSON(object.custom) : undefined,
+ body: isSet(object.body) ? String(object.body) : "",
+ responseBody: isSet(object.responseBody) ? String(object.responseBody) : "",
+ additionalBindings: Array.isArray(object?.additionalBindings)
+ ? object.additionalBindings.map((e: any) => HttpRule.fromJSON(e))
+ : [],
+ };
},
toJSON(message: HttpRule): unknown {
@@ -534,32 +496,28 @@ export const HttpRule = {
return obj;
},
- fromPartial(object: DeepPartial): HttpRule {
- const message = { ...baseHttpRule } as HttpRule;
+ fromPartial, I>>(object: I): HttpRule {
+ const message = createBaseHttpRule();
message.selector = object.selector ?? "";
message.get = object.get ?? undefined;
message.put = object.put ?? undefined;
message.post = object.post ?? undefined;
message.delete = object.delete ?? undefined;
message.patch = object.patch ?? undefined;
- if (object.custom !== undefined && object.custom !== null) {
- message.custom = CustomHttpPattern.fromPartial(object.custom);
- } else {
- message.custom = undefined;
- }
+ message.custom =
+ object.custom !== undefined && object.custom !== null
+ ? CustomHttpPattern.fromPartial(object.custom)
+ : undefined;
message.body = object.body ?? "";
message.responseBody = object.responseBody ?? "";
- message.additionalBindings = [];
- if (object.additionalBindings !== undefined && object.additionalBindings !== null) {
- for (const e of object.additionalBindings) {
- message.additionalBindings.push(HttpRule.fromPartial(e));
- }
- }
+ message.additionalBindings = object.additionalBindings?.map((e) => HttpRule.fromPartial(e)) || [];
return message;
},
};
-const baseCustomHttpPattern: object = { kind: "", path: "" };
+function createBaseCustomHttpPattern(): CustomHttpPattern {
+ return { kind: "", path: "" };
+}
export const CustomHttpPattern = {
encode(message: CustomHttpPattern, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
@@ -575,7 +533,7 @@ export const CustomHttpPattern = {
decode(input: _m0.Reader | Uint8Array, length?: number): CustomHttpPattern {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
- const message = { ...baseCustomHttpPattern } as CustomHttpPattern;
+ const message = createBaseCustomHttpPattern();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -594,18 +552,10 @@ export const CustomHttpPattern = {
},
fromJSON(object: any): CustomHttpPattern {
- const message = { ...baseCustomHttpPattern } as CustomHttpPattern;
- if (object.kind !== undefined && object.kind !== null) {
- message.kind = String(object.kind);
- } else {
- message.kind = "";
- }
- if (object.path !== undefined && object.path !== null) {
- message.path = String(object.path);
- } else {
- message.path = "";
- }
- return message;
+ return {
+ kind: isSet(object.kind) ? String(object.kind) : "",
+ path: isSet(object.path) ? String(object.path) : "",
+ };
},
toJSON(message: CustomHttpPattern): unknown {
@@ -615,17 +565,20 @@ export const CustomHttpPattern = {
return obj;
},
- fromPartial(object: DeepPartial): CustomHttpPattern {
- const message = { ...baseCustomHttpPattern } as CustomHttpPattern;
+ fromPartial, I>>(object: I): CustomHttpPattern {
+ const message = createBaseCustomHttpPattern();
message.kind = object.kind ?? "";
message.path = object.path ?? "";
return message;
},
};
-type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined | Long;
+type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
+
export type DeepPartial = T extends Builtin
? T
+ : T extends Long
+ ? string | number | Long
: T extends Array
? Array>
: T extends ReadonlyArray
@@ -634,7 +587,16 @@ export type DeepPartial