From 122bb2b8c7d94bcb0e7d7aafeb51e4f5516cf4f1 Mon Sep 17 00:00:00 2001 From: Simon Warta Date: Sun, 21 Feb 2021 10:34:39 +0100 Subject: [PATCH] Upgrade ts-proto to 1.67.0 and regenerate --- package.json | 2 +- .../cosmos/base/query/v1beta1/pagination.ts | 70 +- .../src/codec/cosmos/base/v1beta1/coin.ts | 108 +- .../src/codec/x/wasm/internal/types/query.ts | 526 +++--- .../src/codec/x/wasm/internal/types/tx.ts | 380 ++-- .../src/codec/x/wasm/internal/types/types.ts | 280 +-- .../src/codec/cosmos/bank/v1beta1/bank.ts | 220 +-- .../src/codec/cosmos/bank/v1beta1/tx.ts | 98 +- .../src/codec/cosmos/base/v1beta1/coin.ts | 108 +- .../crypto/multisig/v1beta1/multisig.ts | 56 +- .../src/codec/cosmos/crypto/secp256k1/keys.ts | 46 +- .../cosmos/tx/signing/v1beta1/signing.ts | 138 +- .../src/codec/cosmos/tx/v1beta1/tx.ts | 374 ++-- .../src/codec/google/protobuf/any.ts | 30 +- .../src/codec/google/protobuf/descriptor.ts | 1342 +++++++------- .../src/codec/tendermint/crypto/keys.ts | 24 +- packages/stargate/src/codec/confio/proofs.ts | 456 ++--- .../src/codec/cosmos/auth/v1beta1/auth.ts | 122 +- .../src/codec/cosmos/auth/v1beta1/query.ts | 88 +- .../src/codec/cosmos/bank/v1beta1/bank.ts | 220 +-- .../src/codec/cosmos/bank/v1beta1/query.ts | 236 +-- .../src/codec/cosmos/bank/v1beta1/tx.ts | 98 +- .../codec/cosmos/base/abci/v1beta1/abci.ts | 372 ++-- .../cosmos/base/query/v1beta1/pagination.ts | 70 +- .../src/codec/cosmos/base/v1beta1/coin.ts | 108 +- .../crypto/multisig/v1beta1/multisig.ts | 56 +- .../src/codec/cosmos/crypto/secp256k1/keys.ts | 46 +- .../distribution/v1beta1/distribution.ts | 394 ++-- .../cosmos/distribution/v1beta1/query.ts | 484 ++--- .../codec/cosmos/distribution/v1beta1/tx.ts | 174 +- .../src/codec/cosmos/staking/v1beta1/query.ts | 782 ++++---- .../codec/cosmos/staking/v1beta1/staking.ts | 682 +++---- .../src/codec/cosmos/staking/v1beta1/tx.ts | 254 +-- .../cosmos/tx/signing/v1beta1/signing.ts | 138 +- .../src/codec/cosmos/tx/v1beta1/tx.ts | 374 ++-- .../stargate/src/codec/google/protobuf/any.ts | 30 +- .../src/codec/google/protobuf/duration.ts | 26 +- .../src/codec/google/protobuf/timestamp.ts | 26 +- .../src/codec/ibc/core/channel/v1/channel.ts | 256 +-- .../src/codec/ibc/core/channel/v1/query.ts | 832 +++++---- .../src/codec/ibc/core/client/v1/client.ts | 174 +- .../ibc/core/commitment/v1/commitment.ts | 104 +- .../ibc/core/connection/v1/connection.ts | 214 ++- .../src/codec/ibc/core/connection/v1/query.ts | 324 ++-- .../src/codec/tendermint/abci/types.ts | 1584 +++++++++-------- .../src/codec/tendermint/crypto/keys.ts | 24 +- .../src/codec/tendermint/crypto/proof.ts | 164 +- .../src/codec/tendermint/libs/bits/types.ts | 30 +- .../src/codec/tendermint/types/params.ts | 176 +- .../src/codec/tendermint/types/types.ts | 568 +++--- .../src/codec/tendermint/types/validator.ts | 102 +- .../src/codec/tendermint/version/types.ts | 52 +- yarn.lock | 16 +- 53 files changed, 7460 insertions(+), 6198 deletions(-) diff --git a/package.json b/package.json index f2626097..69e7f35e 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,7 @@ "ses": "^0.11.0", "shx": "^0.3.2", "source-map-support": "^0.5.19", - "ts-proto": "=1.61.0", + "ts-proto": "^1.67.0", "typedoc": "^0.19", "typescript": "~4.0", "webpack": "^4.43.0", diff --git a/packages/cosmwasm-stargate/src/codec/cosmos/base/query/v1beta1/pagination.ts b/packages/cosmwasm-stargate/src/codec/cosmos/base/query/v1beta1/pagination.ts index 8dca3c76..45715b50 100644 --- a/packages/cosmwasm-stargate/src/codec/cosmos/base/query/v1beta1/pagination.ts +++ b/packages/cosmwasm-stargate/src/codec/cosmos/base/query/v1beta1/pagination.ts @@ -66,17 +66,25 @@ const basePageRequest: object = { offset: Long.UZERO, limit: Long.UZERO, countTo export const PageRequest = { encode(message: PageRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).bytes(message.key); - writer.uint32(16).uint64(message.offset); - writer.uint32(24).uint64(message.limit); - writer.uint32(32).bool(message.countTotal); + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (!message.offset.isZero()) { + writer.uint32(16).uint64(message.offset); + } + if (!message.limit.isZero()) { + writer.uint32(24).uint64(message.limit); + } + if (message.countTotal === true) { + writer.uint32(32).bool(message.countTotal); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): PageRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(basePageRequest) as PageRequest; + const message = { ...basePageRequest } as PageRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -101,7 +109,7 @@ export const PageRequest = { }, fromJSON(object: any): PageRequest { - const message = Object.create(basePageRequest) as PageRequest; + const message = { ...basePageRequest } as PageRequest; if (object.key !== undefined && object.key !== null) { message.key = bytesFromBase64(object.key); } @@ -123,6 +131,16 @@ export const PageRequest = { return message; }, + toJSON(message: PageRequest): unknown { + const obj: any = {}; + message.key !== undefined && + (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); + 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); + return obj; + }, + fromPartial(object: DeepPartial): PageRequest { const message = { ...basePageRequest } as PageRequest; if (object.key !== undefined && object.key !== null) { @@ -147,31 +165,25 @@ export const PageRequest = { } return message; }, - - toJSON(message: PageRequest): unknown { - const obj: any = {}; - message.key !== undefined && - (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); - 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); - return obj; - }, }; const basePageResponse: object = { total: Long.UZERO }; export const PageResponse = { encode(message: PageResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).bytes(message.nextKey); - writer.uint32(16).uint64(message.total); + if (message.nextKey.length !== 0) { + writer.uint32(10).bytes(message.nextKey); + } + if (!message.total.isZero()) { + writer.uint32(16).uint64(message.total); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): PageResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(basePageResponse) as PageResponse; + const message = { ...basePageResponse } as PageResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -190,7 +202,7 @@ export const PageResponse = { }, fromJSON(object: any): PageResponse { - const message = Object.create(basePageResponse) as PageResponse; + const message = { ...basePageResponse } as PageResponse; if (object.nextKey !== undefined && object.nextKey !== null) { message.nextKey = bytesFromBase64(object.nextKey); } @@ -202,6 +214,14 @@ export const PageResponse = { return message; }, + toJSON(message: PageResponse): unknown { + const obj: any = {}; + message.nextKey !== undefined && + (obj.nextKey = base64FromBytes(message.nextKey !== undefined ? message.nextKey : new Uint8Array())); + message.total !== undefined && (obj.total = (message.total || Long.UZERO).toString()); + return obj; + }, + fromPartial(object: DeepPartial): PageResponse { const message = { ...basePageResponse } as PageResponse; if (object.nextKey !== undefined && object.nextKey !== null) { @@ -216,14 +236,6 @@ export const PageResponse = { } return message; }, - - toJSON(message: PageResponse): unknown { - const obj: any = {}; - message.nextKey !== undefined && - (obj.nextKey = base64FromBytes(message.nextKey !== undefined ? message.nextKey : new Uint8Array())); - message.total !== undefined && (obj.total = (message.total || Long.UZERO).toString()); - return obj; - }, }; declare var self: any | undefined; @@ -233,7 +245,7 @@ var globalThis: any = (() => { if (typeof self !== "undefined") return self; if (typeof window !== "undefined") return window; if (typeof global !== "undefined") return global; - throw new Error("Unable to locate global object"); + throw "Unable to locate global object"; })(); const atob: (b64: string) => string = diff --git a/packages/cosmwasm-stargate/src/codec/cosmos/base/v1beta1/coin.ts b/packages/cosmwasm-stargate/src/codec/cosmos/base/v1beta1/coin.ts index 87506a94..e682a9a7 100644 --- a/packages/cosmwasm-stargate/src/codec/cosmos/base/v1beta1/coin.ts +++ b/packages/cosmwasm-stargate/src/codec/cosmos/base/v1beta1/coin.ts @@ -40,15 +40,19 @@ const baseCoin: object = { denom: "", amount: "" }; export const Coin = { encode(message: Coin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.denom); - writer.uint32(18).string(message.amount); + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): Coin { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseCoin) as Coin; + const message = { ...baseCoin } as Coin; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -67,7 +71,7 @@ export const Coin = { }, fromJSON(object: any): Coin { - const message = Object.create(baseCoin) as Coin; + const message = { ...baseCoin } as Coin; if (object.denom !== undefined && object.denom !== null) { message.denom = String(object.denom); } else { @@ -81,6 +85,13 @@ export const Coin = { return message; }, + toJSON(message: Coin): unknown { + const obj: any = {}; + message.denom !== undefined && (obj.denom = message.denom); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + fromPartial(object: DeepPartial): Coin { const message = { ...baseCoin } as Coin; if (object.denom !== undefined && object.denom !== null) { @@ -95,28 +106,25 @@ export const Coin = { } return message; }, - - toJSON(message: Coin): unknown { - const obj: any = {}; - message.denom !== undefined && (obj.denom = message.denom); - message.amount !== undefined && (obj.amount = message.amount); - return obj; - }, }; const baseDecCoin: object = { denom: "", amount: "" }; export const DecCoin = { encode(message: DecCoin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.denom); - writer.uint32(18).string(message.amount); + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): DecCoin { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseDecCoin) as DecCoin; + const message = { ...baseDecCoin } as DecCoin; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -135,7 +143,7 @@ export const DecCoin = { }, fromJSON(object: any): DecCoin { - const message = Object.create(baseDecCoin) as DecCoin; + const message = { ...baseDecCoin } as DecCoin; if (object.denom !== undefined && object.denom !== null) { message.denom = String(object.denom); } else { @@ -149,6 +157,13 @@ export const DecCoin = { return message; }, + toJSON(message: DecCoin): unknown { + const obj: any = {}; + message.denom !== undefined && (obj.denom = message.denom); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + fromPartial(object: DeepPartial): DecCoin { const message = { ...baseDecCoin } as DecCoin; if (object.denom !== undefined && object.denom !== null) { @@ -163,27 +178,22 @@ export const DecCoin = { } return message; }, - - toJSON(message: DecCoin): unknown { - const obj: any = {}; - message.denom !== undefined && (obj.denom = message.denom); - message.amount !== undefined && (obj.amount = message.amount); - return obj; - }, }; const baseIntProto: object = { int: "" }; export const IntProto = { encode(message: IntProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.int); + if (message.int !== "") { + writer.uint32(10).string(message.int); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): IntProto { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseIntProto) as IntProto; + const message = { ...baseIntProto } as IntProto; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -199,19 +209,9 @@ export const IntProto = { }, fromJSON(object: any): IntProto { - const message = Object.create(baseIntProto) as IntProto; - if (object.int !== undefined && object.int !== null) { - message.int = String(object.int); - } else { - message.int = ""; - } - return message; - }, - - fromPartial(object: DeepPartial): IntProto { const message = { ...baseIntProto } as IntProto; if (object.int !== undefined && object.int !== null) { - message.int = object.int; + message.int = String(object.int); } else { message.int = ""; } @@ -223,20 +223,32 @@ export const IntProto = { message.int !== undefined && (obj.int = message.int); return obj; }, + + fromPartial(object: DeepPartial): IntProto { + const message = { ...baseIntProto } as IntProto; + if (object.int !== undefined && object.int !== null) { + message.int = object.int; + } else { + message.int = ""; + } + return message; + }, }; const baseDecProto: object = { dec: "" }; export const DecProto = { encode(message: DecProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.dec); + if (message.dec !== "") { + writer.uint32(10).string(message.dec); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): DecProto { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseDecProto) as DecProto; + const message = { ...baseDecProto } as DecProto; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -252,19 +264,9 @@ export const DecProto = { }, fromJSON(object: any): DecProto { - const message = Object.create(baseDecProto) as DecProto; - if (object.dec !== undefined && object.dec !== null) { - message.dec = String(object.dec); - } else { - message.dec = ""; - } - return message; - }, - - fromPartial(object: DeepPartial): DecProto { const message = { ...baseDecProto } as DecProto; if (object.dec !== undefined && object.dec !== null) { - message.dec = object.dec; + message.dec = String(object.dec); } else { message.dec = ""; } @@ -276,6 +278,16 @@ export const DecProto = { message.dec !== undefined && (obj.dec = message.dec); return obj; }, + + fromPartial(object: DeepPartial): DecProto { + const message = { ...baseDecProto } as DecProto; + if (object.dec !== undefined && object.dec !== null) { + message.dec = object.dec; + } else { + message.dec = ""; + } + return message; + }, }; type Builtin = Date | Function | Uint8Array | string | number | undefined | Long; diff --git a/packages/cosmwasm-stargate/src/codec/x/wasm/internal/types/query.ts b/packages/cosmwasm-stargate/src/codec/x/wasm/internal/types/query.ts index e133a4ed..9ea49552 100644 --- a/packages/cosmwasm-stargate/src/codec/x/wasm/internal/types/query.ts +++ b/packages/cosmwasm-stargate/src/codec/x/wasm/internal/types/query.ts @@ -136,14 +136,16 @@ const baseQueryContractInfoRequest: object = { address: "" }; export const QueryContractInfoRequest = { encode(message: QueryContractInfoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.address); + if (message.address !== "") { + writer.uint32(10).string(message.address); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryContractInfoRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryContractInfoRequest) as QueryContractInfoRequest; + const message = { ...baseQueryContractInfoRequest } as QueryContractInfoRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -159,19 +161,9 @@ export const QueryContractInfoRequest = { }, fromJSON(object: any): QueryContractInfoRequest { - const message = Object.create(baseQueryContractInfoRequest) as QueryContractInfoRequest; - if (object.address !== undefined && object.address !== null) { - message.address = String(object.address); - } else { - message.address = ""; - } - return message; - }, - - fromPartial(object: DeepPartial): QueryContractInfoRequest { const message = { ...baseQueryContractInfoRequest } as QueryContractInfoRequest; if (object.address !== undefined && object.address !== null) { - message.address = object.address; + message.address = String(object.address); } else { message.address = ""; } @@ -183,13 +175,25 @@ export const QueryContractInfoRequest = { message.address !== undefined && (obj.address = message.address); return obj; }, + + fromPartial(object: DeepPartial): QueryContractInfoRequest { + const message = { ...baseQueryContractInfoRequest } as QueryContractInfoRequest; + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } else { + message.address = ""; + } + return message; + }, }; const baseQueryContractInfoResponse: object = { address: "" }; export const QueryContractInfoResponse = { encode(message: QueryContractInfoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.address); + if (message.address !== "") { + writer.uint32(10).string(message.address); + } if (message.contractInfo !== undefined) { ContractInfo.encode(message.contractInfo, writer.uint32(18).fork()).ldelim(); } @@ -199,7 +203,7 @@ export const QueryContractInfoResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryContractInfoResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryContractInfoResponse) as QueryContractInfoResponse; + const message = { ...baseQueryContractInfoResponse } as QueryContractInfoResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -218,7 +222,7 @@ export const QueryContractInfoResponse = { }, fromJSON(object: any): QueryContractInfoResponse { - const message = Object.create(baseQueryContractInfoResponse) as QueryContractInfoResponse; + const message = { ...baseQueryContractInfoResponse } as QueryContractInfoResponse; if (object.address !== undefined && object.address !== null) { message.address = String(object.address); } else { @@ -232,6 +236,14 @@ export const QueryContractInfoResponse = { return message; }, + toJSON(message: QueryContractInfoResponse): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.contractInfo !== undefined && + (obj.contractInfo = message.contractInfo ? ContractInfo.toJSON(message.contractInfo) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): QueryContractInfoResponse { const message = { ...baseQueryContractInfoResponse } as QueryContractInfoResponse; if (object.address !== undefined && object.address !== null) { @@ -246,21 +258,15 @@ export const QueryContractInfoResponse = { } return message; }, - - toJSON(message: QueryContractInfoResponse): unknown { - const obj: any = {}; - message.address !== undefined && (obj.address = message.address); - message.contractInfo !== undefined && - (obj.contractInfo = message.contractInfo ? ContractInfo.toJSON(message.contractInfo) : undefined); - return obj; - }, }; const baseQueryContractHistoryRequest: object = { address: "" }; export const QueryContractHistoryRequest = { encode(message: QueryContractHistoryRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.address); + if (message.address !== "") { + writer.uint32(10).string(message.address); + } if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } @@ -270,7 +276,7 @@ export const QueryContractHistoryRequest = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryContractHistoryRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryContractHistoryRequest) as QueryContractHistoryRequest; + const message = { ...baseQueryContractHistoryRequest } as QueryContractHistoryRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -289,7 +295,7 @@ export const QueryContractHistoryRequest = { }, fromJSON(object: any): QueryContractHistoryRequest { - const message = Object.create(baseQueryContractHistoryRequest) as QueryContractHistoryRequest; + const message = { ...baseQueryContractHistoryRequest } as QueryContractHistoryRequest; if (object.address !== undefined && object.address !== null) { message.address = String(object.address); } else { @@ -303,6 +309,14 @@ export const QueryContractHistoryRequest = { return message; }, + toJSON(message: QueryContractHistoryRequest): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): QueryContractHistoryRequest { const message = { ...baseQueryContractHistoryRequest } as QueryContractHistoryRequest; if (object.address !== undefined && object.address !== null) { @@ -317,14 +331,6 @@ export const QueryContractHistoryRequest = { } return message; }, - - toJSON(message: QueryContractHistoryRequest): unknown { - const obj: any = {}; - message.address !== undefined && (obj.address = message.address); - message.pagination !== undefined && - (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); - return obj; - }, }; const baseQueryContractHistoryResponse: object = {}; @@ -343,7 +349,7 @@ export const QueryContractHistoryResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryContractHistoryResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryContractHistoryResponse) as QueryContractHistoryResponse; + const message = { ...baseQueryContractHistoryResponse } as QueryContractHistoryResponse; message.entries = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -363,7 +369,7 @@ export const QueryContractHistoryResponse = { }, fromJSON(object: any): QueryContractHistoryResponse { - const message = Object.create(baseQueryContractHistoryResponse) as QueryContractHistoryResponse; + const message = { ...baseQueryContractHistoryResponse } as QueryContractHistoryResponse; message.entries = []; if (object.entries !== undefined && object.entries !== null) { for (const e of object.entries) { @@ -378,22 +384,6 @@ export const QueryContractHistoryResponse = { return message; }, - fromPartial(object: DeepPartial): QueryContractHistoryResponse { - const message = { ...baseQueryContractHistoryResponse } as QueryContractHistoryResponse; - message.entries = []; - if (object.entries !== undefined && object.entries !== null) { - for (const e of object.entries) { - message.entries.push(ContractCodeHistoryEntry.fromPartial(e)); - } - } - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageResponse.fromPartial(object.pagination); - } else { - message.pagination = undefined; - } - return message; - }, - toJSON(message: QueryContractHistoryResponse): unknown { const obj: any = {}; if (message.entries) { @@ -405,13 +395,31 @@ export const QueryContractHistoryResponse = { (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); return obj; }, + + fromPartial(object: DeepPartial): QueryContractHistoryResponse { + const message = { ...baseQueryContractHistoryResponse } as QueryContractHistoryResponse; + message.entries = []; + if (object.entries !== undefined && object.entries !== null) { + for (const e of object.entries) { + message.entries.push(ContractCodeHistoryEntry.fromPartial(e)); + } + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromPartial(object.pagination); + } else { + message.pagination = undefined; + } + return message; + }, }; const baseQueryContractsByCodeRequest: object = { codeId: Long.UZERO }; export const QueryContractsByCodeRequest = { encode(message: QueryContractsByCodeRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).uint64(message.codeId); + if (!message.codeId.isZero()) { + writer.uint32(8).uint64(message.codeId); + } if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } @@ -421,7 +429,7 @@ export const QueryContractsByCodeRequest = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryContractsByCodeRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryContractsByCodeRequest) as QueryContractsByCodeRequest; + const message = { ...baseQueryContractsByCodeRequest } as QueryContractsByCodeRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -440,7 +448,7 @@ export const QueryContractsByCodeRequest = { }, fromJSON(object: any): QueryContractsByCodeRequest { - const message = Object.create(baseQueryContractsByCodeRequest) as QueryContractsByCodeRequest; + const message = { ...baseQueryContractsByCodeRequest } as QueryContractsByCodeRequest; if (object.codeId !== undefined && object.codeId !== null) { message.codeId = Long.fromString(object.codeId); } else { @@ -454,6 +462,14 @@ export const QueryContractsByCodeRequest = { return message; }, + toJSON(message: QueryContractsByCodeRequest): unknown { + const obj: any = {}; + message.codeId !== undefined && (obj.codeId = (message.codeId || Long.UZERO).toString()); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): QueryContractsByCodeRequest { const message = { ...baseQueryContractsByCodeRequest } as QueryContractsByCodeRequest; if (object.codeId !== undefined && object.codeId !== null) { @@ -468,21 +484,15 @@ export const QueryContractsByCodeRequest = { } return message; }, - - toJSON(message: QueryContractsByCodeRequest): unknown { - const obj: any = {}; - message.codeId !== undefined && (obj.codeId = (message.codeId || Long.UZERO).toString()); - message.pagination !== undefined && - (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); - return obj; - }, }; const baseContractInfoWithAddress: object = { address: "" }; export const ContractInfoWithAddress = { encode(message: ContractInfoWithAddress, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.address); + if (message.address !== "") { + writer.uint32(10).string(message.address); + } if (message.contractInfo !== undefined) { ContractInfo.encode(message.contractInfo, writer.uint32(18).fork()).ldelim(); } @@ -492,7 +502,7 @@ export const ContractInfoWithAddress = { decode(input: _m0.Reader | Uint8Array, length?: number): ContractInfoWithAddress { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseContractInfoWithAddress) as ContractInfoWithAddress; + const message = { ...baseContractInfoWithAddress } as ContractInfoWithAddress; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -511,7 +521,7 @@ export const ContractInfoWithAddress = { }, fromJSON(object: any): ContractInfoWithAddress { - const message = Object.create(baseContractInfoWithAddress) as ContractInfoWithAddress; + const message = { ...baseContractInfoWithAddress } as ContractInfoWithAddress; if (object.address !== undefined && object.address !== null) { message.address = String(object.address); } else { @@ -525,6 +535,14 @@ export const ContractInfoWithAddress = { return message; }, + toJSON(message: ContractInfoWithAddress): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.contractInfo !== undefined && + (obj.contractInfo = message.contractInfo ? ContractInfo.toJSON(message.contractInfo) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): ContractInfoWithAddress { const message = { ...baseContractInfoWithAddress } as ContractInfoWithAddress; if (object.address !== undefined && object.address !== null) { @@ -539,14 +557,6 @@ export const ContractInfoWithAddress = { } return message; }, - - toJSON(message: ContractInfoWithAddress): unknown { - const obj: any = {}; - message.address !== undefined && (obj.address = message.address); - message.contractInfo !== undefined && - (obj.contractInfo = message.contractInfo ? ContractInfo.toJSON(message.contractInfo) : undefined); - return obj; - }, }; const baseQueryContractsByCodeResponse: object = {}; @@ -565,7 +575,7 @@ export const QueryContractsByCodeResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryContractsByCodeResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryContractsByCodeResponse) as QueryContractsByCodeResponse; + const message = { ...baseQueryContractsByCodeResponse } as QueryContractsByCodeResponse; message.contractInfos = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -585,7 +595,7 @@ export const QueryContractsByCodeResponse = { }, fromJSON(object: any): QueryContractsByCodeResponse { - const message = Object.create(baseQueryContractsByCodeResponse) as QueryContractsByCodeResponse; + const message = { ...baseQueryContractsByCodeResponse } as QueryContractsByCodeResponse; message.contractInfos = []; if (object.contractInfos !== undefined && object.contractInfos !== null) { for (const e of object.contractInfos) { @@ -600,22 +610,6 @@ export const QueryContractsByCodeResponse = { return message; }, - fromPartial(object: DeepPartial): QueryContractsByCodeResponse { - const message = { ...baseQueryContractsByCodeResponse } as QueryContractsByCodeResponse; - message.contractInfos = []; - if (object.contractInfos !== undefined && object.contractInfos !== null) { - for (const e of object.contractInfos) { - message.contractInfos.push(ContractInfoWithAddress.fromPartial(e)); - } - } - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageResponse.fromPartial(object.pagination); - } else { - message.pagination = undefined; - } - return message; - }, - toJSON(message: QueryContractsByCodeResponse): unknown { const obj: any = {}; if (message.contractInfos) { @@ -629,13 +623,31 @@ export const QueryContractsByCodeResponse = { (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); return obj; }, + + fromPartial(object: DeepPartial): QueryContractsByCodeResponse { + const message = { ...baseQueryContractsByCodeResponse } as QueryContractsByCodeResponse; + message.contractInfos = []; + if (object.contractInfos !== undefined && object.contractInfos !== null) { + for (const e of object.contractInfos) { + message.contractInfos.push(ContractInfoWithAddress.fromPartial(e)); + } + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromPartial(object.pagination); + } else { + message.pagination = undefined; + } + return message; + }, }; const baseQueryAllContractStateRequest: object = { address: "" }; export const QueryAllContractStateRequest = { encode(message: QueryAllContractStateRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.address); + if (message.address !== "") { + writer.uint32(10).string(message.address); + } if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } @@ -645,7 +657,7 @@ export const QueryAllContractStateRequest = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllContractStateRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryAllContractStateRequest) as QueryAllContractStateRequest; + const message = { ...baseQueryAllContractStateRequest } as QueryAllContractStateRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -664,7 +676,7 @@ export const QueryAllContractStateRequest = { }, fromJSON(object: any): QueryAllContractStateRequest { - const message = Object.create(baseQueryAllContractStateRequest) as QueryAllContractStateRequest; + const message = { ...baseQueryAllContractStateRequest } as QueryAllContractStateRequest; if (object.address !== undefined && object.address !== null) { message.address = String(object.address); } else { @@ -678,6 +690,14 @@ export const QueryAllContractStateRequest = { return message; }, + toJSON(message: QueryAllContractStateRequest): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): QueryAllContractStateRequest { const message = { ...baseQueryAllContractStateRequest } as QueryAllContractStateRequest; if (object.address !== undefined && object.address !== null) { @@ -692,14 +712,6 @@ export const QueryAllContractStateRequest = { } return message; }, - - toJSON(message: QueryAllContractStateRequest): unknown { - const obj: any = {}; - message.address !== undefined && (obj.address = message.address); - message.pagination !== undefined && - (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); - return obj; - }, }; const baseQueryAllContractStateResponse: object = {}; @@ -718,7 +730,7 @@ export const QueryAllContractStateResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllContractStateResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryAllContractStateResponse) as QueryAllContractStateResponse; + const message = { ...baseQueryAllContractStateResponse } as QueryAllContractStateResponse; message.models = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -738,7 +750,7 @@ export const QueryAllContractStateResponse = { }, fromJSON(object: any): QueryAllContractStateResponse { - const message = Object.create(baseQueryAllContractStateResponse) as QueryAllContractStateResponse; + const message = { ...baseQueryAllContractStateResponse } as QueryAllContractStateResponse; message.models = []; if (object.models !== undefined && object.models !== null) { for (const e of object.models) { @@ -753,22 +765,6 @@ export const QueryAllContractStateResponse = { return message; }, - fromPartial(object: DeepPartial): QueryAllContractStateResponse { - const message = { ...baseQueryAllContractStateResponse } as QueryAllContractStateResponse; - message.models = []; - if (object.models !== undefined && object.models !== null) { - for (const e of object.models) { - message.models.push(Model.fromPartial(e)); - } - } - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageResponse.fromPartial(object.pagination); - } else { - message.pagination = undefined; - } - return message; - }, - toJSON(message: QueryAllContractStateResponse): unknown { const obj: any = {}; if (message.models) { @@ -780,21 +776,41 @@ export const QueryAllContractStateResponse = { (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); return obj; }, + + fromPartial(object: DeepPartial): QueryAllContractStateResponse { + const message = { ...baseQueryAllContractStateResponse } as QueryAllContractStateResponse; + message.models = []; + if (object.models !== undefined && object.models !== null) { + for (const e of object.models) { + message.models.push(Model.fromPartial(e)); + } + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromPartial(object.pagination); + } else { + message.pagination = undefined; + } + return message; + }, }; const baseQueryRawContractStateRequest: object = { address: "" }; export const QueryRawContractStateRequest = { encode(message: QueryRawContractStateRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.address); - writer.uint32(18).bytes(message.queryData); + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.queryData.length !== 0) { + writer.uint32(18).bytes(message.queryData); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryRawContractStateRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryRawContractStateRequest) as QueryRawContractStateRequest; + const message = { ...baseQueryRawContractStateRequest } as QueryRawContractStateRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -813,7 +829,7 @@ export const QueryRawContractStateRequest = { }, fromJSON(object: any): QueryRawContractStateRequest { - const message = Object.create(baseQueryRawContractStateRequest) as QueryRawContractStateRequest; + const message = { ...baseQueryRawContractStateRequest } as QueryRawContractStateRequest; if (object.address !== undefined && object.address !== null) { message.address = String(object.address); } else { @@ -825,6 +841,16 @@ export const QueryRawContractStateRequest = { return message; }, + toJSON(message: QueryRawContractStateRequest): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.queryData !== undefined && + (obj.queryData = base64FromBytes( + message.queryData !== undefined ? message.queryData : new Uint8Array(), + )); + return obj; + }, + fromPartial(object: DeepPartial): QueryRawContractStateRequest { const message = { ...baseQueryRawContractStateRequest } as QueryRawContractStateRequest; if (object.address !== undefined && object.address !== null) { @@ -839,30 +865,22 @@ export const QueryRawContractStateRequest = { } return message; }, - - toJSON(message: QueryRawContractStateRequest): unknown { - const obj: any = {}; - message.address !== undefined && (obj.address = message.address); - message.queryData !== undefined && - (obj.queryData = base64FromBytes( - message.queryData !== undefined ? message.queryData : new Uint8Array(), - )); - return obj; - }, }; const baseQueryRawContractStateResponse: object = {}; export const QueryRawContractStateResponse = { encode(message: QueryRawContractStateResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).bytes(message.data); + if (message.data.length !== 0) { + writer.uint32(10).bytes(message.data); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryRawContractStateResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryRawContractStateResponse) as QueryRawContractStateResponse; + const message = { ...baseQueryRawContractStateResponse } as QueryRawContractStateResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -878,13 +896,20 @@ export const QueryRawContractStateResponse = { }, fromJSON(object: any): QueryRawContractStateResponse { - const message = Object.create(baseQueryRawContractStateResponse) as QueryRawContractStateResponse; + const message = { ...baseQueryRawContractStateResponse } as QueryRawContractStateResponse; if (object.data !== undefined && object.data !== null) { message.data = bytesFromBase64(object.data); } return message; }, + toJSON(message: QueryRawContractStateResponse): unknown { + const obj: any = {}; + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); + return obj; + }, + fromPartial(object: DeepPartial): QueryRawContractStateResponse { const message = { ...baseQueryRawContractStateResponse } as QueryRawContractStateResponse; if (object.data !== undefined && object.data !== null) { @@ -894,28 +919,25 @@ export const QueryRawContractStateResponse = { } return message; }, - - toJSON(message: QueryRawContractStateResponse): unknown { - const obj: any = {}; - message.data !== undefined && - (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); - return obj; - }, }; const baseQuerySmartContractStateRequest: object = { address: "" }; export const QuerySmartContractStateRequest = { encode(message: QuerySmartContractStateRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.address); - writer.uint32(18).bytes(message.queryData); + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.queryData.length !== 0) { + writer.uint32(18).bytes(message.queryData); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): QuerySmartContractStateRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQuerySmartContractStateRequest) as QuerySmartContractStateRequest; + const message = { ...baseQuerySmartContractStateRequest } as QuerySmartContractStateRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -934,7 +956,7 @@ export const QuerySmartContractStateRequest = { }, fromJSON(object: any): QuerySmartContractStateRequest { - const message = Object.create(baseQuerySmartContractStateRequest) as QuerySmartContractStateRequest; + const message = { ...baseQuerySmartContractStateRequest } as QuerySmartContractStateRequest; if (object.address !== undefined && object.address !== null) { message.address = String(object.address); } else { @@ -946,6 +968,16 @@ export const QuerySmartContractStateRequest = { return message; }, + toJSON(message: QuerySmartContractStateRequest): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.queryData !== undefined && + (obj.queryData = base64FromBytes( + message.queryData !== undefined ? message.queryData : new Uint8Array(), + )); + return obj; + }, + fromPartial(object: DeepPartial): QuerySmartContractStateRequest { const message = { ...baseQuerySmartContractStateRequest } as QuerySmartContractStateRequest; if (object.address !== undefined && object.address !== null) { @@ -960,30 +992,22 @@ export const QuerySmartContractStateRequest = { } return message; }, - - toJSON(message: QuerySmartContractStateRequest): unknown { - const obj: any = {}; - message.address !== undefined && (obj.address = message.address); - message.queryData !== undefined && - (obj.queryData = base64FromBytes( - message.queryData !== undefined ? message.queryData : new Uint8Array(), - )); - return obj; - }, }; const baseQuerySmartContractStateResponse: object = {}; export const QuerySmartContractStateResponse = { encode(message: QuerySmartContractStateResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).bytes(message.data); + if (message.data.length !== 0) { + writer.uint32(10).bytes(message.data); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): QuerySmartContractStateResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQuerySmartContractStateResponse) as QuerySmartContractStateResponse; + const message = { ...baseQuerySmartContractStateResponse } as QuerySmartContractStateResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -999,13 +1023,20 @@ export const QuerySmartContractStateResponse = { }, fromJSON(object: any): QuerySmartContractStateResponse { - const message = Object.create(baseQuerySmartContractStateResponse) as QuerySmartContractStateResponse; + const message = { ...baseQuerySmartContractStateResponse } as QuerySmartContractStateResponse; if (object.data !== undefined && object.data !== null) { message.data = bytesFromBase64(object.data); } return message; }, + toJSON(message: QuerySmartContractStateResponse): unknown { + const obj: any = {}; + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); + return obj; + }, + fromPartial(object: DeepPartial): QuerySmartContractStateResponse { const message = { ...baseQuerySmartContractStateResponse } as QuerySmartContractStateResponse; if (object.data !== undefined && object.data !== null) { @@ -1015,27 +1046,22 @@ export const QuerySmartContractStateResponse = { } return message; }, - - toJSON(message: QuerySmartContractStateResponse): unknown { - const obj: any = {}; - message.data !== undefined && - (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); - return obj; - }, }; const baseQueryCodeRequest: object = { codeId: Long.UZERO }; export const QueryCodeRequest = { encode(message: QueryCodeRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).uint64(message.codeId); + if (!message.codeId.isZero()) { + writer.uint32(8).uint64(message.codeId); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryCodeRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryCodeRequest) as QueryCodeRequest; + const message = { ...baseQueryCodeRequest } as QueryCodeRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1051,19 +1077,9 @@ export const QueryCodeRequest = { }, fromJSON(object: any): QueryCodeRequest { - const message = Object.create(baseQueryCodeRequest) as QueryCodeRequest; - if (object.codeId !== undefined && object.codeId !== null) { - message.codeId = Long.fromString(object.codeId); - } else { - message.codeId = Long.UZERO; - } - return message; - }, - - fromPartial(object: DeepPartial): QueryCodeRequest { const message = { ...baseQueryCodeRequest } as QueryCodeRequest; if (object.codeId !== undefined && object.codeId !== null) { - message.codeId = object.codeId as Long; + message.codeId = Long.fromString(object.codeId); } else { message.codeId = Long.UZERO; } @@ -1075,24 +1091,44 @@ export const QueryCodeRequest = { message.codeId !== undefined && (obj.codeId = (message.codeId || Long.UZERO).toString()); return obj; }, + + fromPartial(object: DeepPartial): QueryCodeRequest { + const message = { ...baseQueryCodeRequest } as QueryCodeRequest; + if (object.codeId !== undefined && object.codeId !== null) { + message.codeId = object.codeId as Long; + } else { + message.codeId = Long.UZERO; + } + return message; + }, }; const baseCodeInfoResponse: object = { codeId: Long.UZERO, creator: "", source: "", builder: "" }; export const CodeInfoResponse = { encode(message: CodeInfoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).uint64(message.codeId); - writer.uint32(18).string(message.creator); - writer.uint32(26).bytes(message.dataHash); - writer.uint32(34).string(message.source); - writer.uint32(42).string(message.builder); + if (!message.codeId.isZero()) { + writer.uint32(8).uint64(message.codeId); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.dataHash.length !== 0) { + writer.uint32(26).bytes(message.dataHash); + } + if (message.source !== "") { + writer.uint32(34).string(message.source); + } + if (message.builder !== "") { + writer.uint32(42).string(message.builder); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): CodeInfoResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseCodeInfoResponse) as CodeInfoResponse; + const message = { ...baseCodeInfoResponse } as CodeInfoResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1120,7 +1156,7 @@ export const CodeInfoResponse = { }, fromJSON(object: any): CodeInfoResponse { - const message = Object.create(baseCodeInfoResponse) as CodeInfoResponse; + const message = { ...baseCodeInfoResponse } as CodeInfoResponse; if (object.codeId !== undefined && object.codeId !== null) { message.codeId = Long.fromString(object.codeId); } else { @@ -1147,6 +1183,17 @@ export const CodeInfoResponse = { return message; }, + toJSON(message: CodeInfoResponse): unknown { + const obj: any = {}; + message.codeId !== undefined && (obj.codeId = (message.codeId || Long.UZERO).toString()); + message.creator !== undefined && (obj.creator = message.creator); + message.dataHash !== undefined && + (obj.dataHash = base64FromBytes(message.dataHash !== undefined ? message.dataHash : new Uint8Array())); + message.source !== undefined && (obj.source = message.source); + message.builder !== undefined && (obj.builder = message.builder); + return obj; + }, + fromPartial(object: DeepPartial): CodeInfoResponse { const message = { ...baseCodeInfoResponse } as CodeInfoResponse; if (object.codeId !== undefined && object.codeId !== null) { @@ -1176,17 +1223,6 @@ export const CodeInfoResponse = { } return message; }, - - toJSON(message: CodeInfoResponse): unknown { - const obj: any = {}; - message.codeId !== undefined && (obj.codeId = (message.codeId || Long.UZERO).toString()); - message.creator !== undefined && (obj.creator = message.creator); - message.dataHash !== undefined && - (obj.dataHash = base64FromBytes(message.dataHash !== undefined ? message.dataHash : new Uint8Array())); - message.source !== undefined && (obj.source = message.source); - message.builder !== undefined && (obj.builder = message.builder); - return obj; - }, }; const baseQueryCodeResponse: object = {}; @@ -1196,14 +1232,16 @@ export const QueryCodeResponse = { if (message.codeInfo !== undefined) { CodeInfoResponse.encode(message.codeInfo, writer.uint32(10).fork()).ldelim(); } - writer.uint32(18).bytes(message.data); + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryCodeResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryCodeResponse) as QueryCodeResponse; + const message = { ...baseQueryCodeResponse } as QueryCodeResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1222,7 +1260,7 @@ export const QueryCodeResponse = { }, fromJSON(object: any): QueryCodeResponse { - const message = Object.create(baseQueryCodeResponse) as QueryCodeResponse; + const message = { ...baseQueryCodeResponse } as QueryCodeResponse; if (object.codeInfo !== undefined && object.codeInfo !== null) { message.codeInfo = CodeInfoResponse.fromJSON(object.codeInfo); } else { @@ -1234,6 +1272,15 @@ export const QueryCodeResponse = { return message; }, + toJSON(message: QueryCodeResponse): unknown { + const obj: any = {}; + message.codeInfo !== undefined && + (obj.codeInfo = message.codeInfo ? CodeInfoResponse.toJSON(message.codeInfo) : undefined); + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); + return obj; + }, + fromPartial(object: DeepPartial): QueryCodeResponse { const message = { ...baseQueryCodeResponse } as QueryCodeResponse; if (object.codeInfo !== undefined && object.codeInfo !== null) { @@ -1248,15 +1295,6 @@ export const QueryCodeResponse = { } return message; }, - - toJSON(message: QueryCodeResponse): unknown { - const obj: any = {}; - message.codeInfo !== undefined && - (obj.codeInfo = message.codeInfo ? CodeInfoResponse.toJSON(message.codeInfo) : undefined); - message.data !== undefined && - (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); - return obj; - }, }; const baseQueryCodesRequest: object = {}; @@ -1272,7 +1310,7 @@ export const QueryCodesRequest = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryCodesRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryCodesRequest) as QueryCodesRequest; + const message = { ...baseQueryCodesRequest } as QueryCodesRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1288,19 +1326,9 @@ export const QueryCodesRequest = { }, fromJSON(object: any): QueryCodesRequest { - const message = Object.create(baseQueryCodesRequest) as QueryCodesRequest; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageRequest.fromJSON(object.pagination); - } else { - message.pagination = undefined; - } - return message; - }, - - fromPartial(object: DeepPartial): QueryCodesRequest { const message = { ...baseQueryCodesRequest } as QueryCodesRequest; if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageRequest.fromPartial(object.pagination); + message.pagination = PageRequest.fromJSON(object.pagination); } else { message.pagination = undefined; } @@ -1313,6 +1341,16 @@ export const QueryCodesRequest = { (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); return obj; }, + + fromPartial(object: DeepPartial): QueryCodesRequest { + const message = { ...baseQueryCodesRequest } as QueryCodesRequest; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromPartial(object.pagination); + } else { + message.pagination = undefined; + } + return message; + }, }; const baseQueryCodesResponse: object = {}; @@ -1331,7 +1369,7 @@ export const QueryCodesResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryCodesResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryCodesResponse) as QueryCodesResponse; + const message = { ...baseQueryCodesResponse } as QueryCodesResponse; message.codeInfos = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -1351,7 +1389,7 @@ export const QueryCodesResponse = { }, fromJSON(object: any): QueryCodesResponse { - const message = Object.create(baseQueryCodesResponse) as QueryCodesResponse; + const message = { ...baseQueryCodesResponse } as QueryCodesResponse; message.codeInfos = []; if (object.codeInfos !== undefined && object.codeInfos !== null) { for (const e of object.codeInfos) { @@ -1366,22 +1404,6 @@ export const QueryCodesResponse = { return message; }, - fromPartial(object: DeepPartial): QueryCodesResponse { - const message = { ...baseQueryCodesResponse } as QueryCodesResponse; - message.codeInfos = []; - if (object.codeInfos !== undefined && object.codeInfos !== null) { - for (const e of object.codeInfos) { - message.codeInfos.push(CodeInfoResponse.fromPartial(e)); - } - } - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageResponse.fromPartial(object.pagination); - } else { - message.pagination = undefined; - } - return message; - }, - toJSON(message: QueryCodesResponse): unknown { const obj: any = {}; if (message.codeInfos) { @@ -1393,6 +1415,22 @@ export const QueryCodesResponse = { (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); return obj; }, + + fromPartial(object: DeepPartial): QueryCodesResponse { + const message = { ...baseQueryCodesResponse } as QueryCodesResponse; + message.codeInfos = []; + if (object.codeInfos !== undefined && object.codeInfos !== null) { + for (const e of object.codeInfos) { + message.codeInfos.push(CodeInfoResponse.fromPartial(e)); + } + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromPartial(object.pagination); + } else { + message.pagination = undefined; + } + return message; + }, }; /** Query provides defines the gRPC querier service */ @@ -1480,7 +1518,7 @@ var globalThis: any = (() => { if (typeof self !== "undefined") return self; if (typeof window !== "undefined") return window; if (typeof global !== "undefined") return global; - throw new Error("Unable to locate global object"); + throw "Unable to locate global object"; })(); const atob: (b64: string) => string = diff --git a/packages/cosmwasm-stargate/src/codec/x/wasm/internal/types/tx.ts b/packages/cosmwasm-stargate/src/codec/x/wasm/internal/types/tx.ts index c1698a21..63e0a243 100644 --- a/packages/cosmwasm-stargate/src/codec/x/wasm/internal/types/tx.ts +++ b/packages/cosmwasm-stargate/src/codec/x/wasm/internal/types/tx.ts @@ -115,10 +115,18 @@ const baseMsgStoreCode: object = { sender: "", source: "", builder: "" }; export const MsgStoreCode = { encode(message: MsgStoreCode, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.sender); - writer.uint32(18).bytes(message.wasmByteCode); - writer.uint32(26).string(message.source); - writer.uint32(34).string(message.builder); + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.wasmByteCode.length !== 0) { + writer.uint32(18).bytes(message.wasmByteCode); + } + if (message.source !== "") { + writer.uint32(26).string(message.source); + } + if (message.builder !== "") { + writer.uint32(34).string(message.builder); + } if (message.instantiatePermission !== undefined) { AccessConfig.encode(message.instantiatePermission, writer.uint32(42).fork()).ldelim(); } @@ -128,7 +136,7 @@ export const MsgStoreCode = { decode(input: _m0.Reader | Uint8Array, length?: number): MsgStoreCode { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseMsgStoreCode) as MsgStoreCode; + const message = { ...baseMsgStoreCode } as MsgStoreCode; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -156,7 +164,7 @@ export const MsgStoreCode = { }, fromJSON(object: any): MsgStoreCode { - const message = Object.create(baseMsgStoreCode) as MsgStoreCode; + const message = { ...baseMsgStoreCode } as MsgStoreCode; if (object.sender !== undefined && object.sender !== null) { message.sender = String(object.sender); } else { @@ -183,6 +191,22 @@ export const MsgStoreCode = { return message; }, + toJSON(message: MsgStoreCode): unknown { + const obj: any = {}; + message.sender !== undefined && (obj.sender = message.sender); + message.wasmByteCode !== undefined && + (obj.wasmByteCode = base64FromBytes( + message.wasmByteCode !== undefined ? message.wasmByteCode : new Uint8Array(), + )); + message.source !== undefined && (obj.source = message.source); + message.builder !== undefined && (obj.builder = message.builder); + message.instantiatePermission !== undefined && + (obj.instantiatePermission = message.instantiatePermission + ? AccessConfig.toJSON(message.instantiatePermission) + : undefined); + return obj; + }, + fromPartial(object: DeepPartial): MsgStoreCode { const message = { ...baseMsgStoreCode } as MsgStoreCode; if (object.sender !== undefined && object.sender !== null) { @@ -212,36 +236,22 @@ export const MsgStoreCode = { } return message; }, - - toJSON(message: MsgStoreCode): unknown { - const obj: any = {}; - message.sender !== undefined && (obj.sender = message.sender); - message.wasmByteCode !== undefined && - (obj.wasmByteCode = base64FromBytes( - message.wasmByteCode !== undefined ? message.wasmByteCode : new Uint8Array(), - )); - message.source !== undefined && (obj.source = message.source); - message.builder !== undefined && (obj.builder = message.builder); - message.instantiatePermission !== undefined && - (obj.instantiatePermission = message.instantiatePermission - ? AccessConfig.toJSON(message.instantiatePermission) - : undefined); - return obj; - }, }; const baseMsgStoreCodeResponse: object = { codeId: Long.UZERO }; export const MsgStoreCodeResponse = { encode(message: MsgStoreCodeResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).uint64(message.codeId); + if (!message.codeId.isZero()) { + writer.uint32(8).uint64(message.codeId); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgStoreCodeResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseMsgStoreCodeResponse) as MsgStoreCodeResponse; + const message = { ...baseMsgStoreCodeResponse } as MsgStoreCodeResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -257,19 +267,9 @@ export const MsgStoreCodeResponse = { }, fromJSON(object: any): MsgStoreCodeResponse { - const message = Object.create(baseMsgStoreCodeResponse) as MsgStoreCodeResponse; - if (object.codeId !== undefined && object.codeId !== null) { - message.codeId = Long.fromString(object.codeId); - } else { - message.codeId = Long.UZERO; - } - return message; - }, - - fromPartial(object: DeepPartial): MsgStoreCodeResponse { const message = { ...baseMsgStoreCodeResponse } as MsgStoreCodeResponse; if (object.codeId !== undefined && object.codeId !== null) { - message.codeId = object.codeId as Long; + message.codeId = Long.fromString(object.codeId); } else { message.codeId = Long.UZERO; } @@ -281,17 +281,37 @@ export const MsgStoreCodeResponse = { message.codeId !== undefined && (obj.codeId = (message.codeId || Long.UZERO).toString()); return obj; }, + + fromPartial(object: DeepPartial): MsgStoreCodeResponse { + const message = { ...baseMsgStoreCodeResponse } as MsgStoreCodeResponse; + if (object.codeId !== undefined && object.codeId !== null) { + message.codeId = object.codeId as Long; + } else { + message.codeId = Long.UZERO; + } + return message; + }, }; const baseMsgInstantiateContract: object = { sender: "", admin: "", codeId: Long.UZERO, label: "" }; export const MsgInstantiateContract = { encode(message: MsgInstantiateContract, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.sender); - writer.uint32(18).string(message.admin); - writer.uint32(24).uint64(message.codeId); - writer.uint32(34).string(message.label); - writer.uint32(42).bytes(message.initMsg); + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.admin !== "") { + writer.uint32(18).string(message.admin); + } + if (!message.codeId.isZero()) { + writer.uint32(24).uint64(message.codeId); + } + if (message.label !== "") { + writer.uint32(34).string(message.label); + } + if (message.initMsg.length !== 0) { + writer.uint32(42).bytes(message.initMsg); + } for (const v of message.initFunds) { Coin.encode(v!, writer.uint32(50).fork()).ldelim(); } @@ -301,7 +321,7 @@ export const MsgInstantiateContract = { decode(input: _m0.Reader | Uint8Array, length?: number): MsgInstantiateContract { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseMsgInstantiateContract) as MsgInstantiateContract; + const message = { ...baseMsgInstantiateContract } as MsgInstantiateContract; message.initFunds = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -333,7 +353,7 @@ export const MsgInstantiateContract = { }, fromJSON(object: any): MsgInstantiateContract { - const message = Object.create(baseMsgInstantiateContract) as MsgInstantiateContract; + const message = { ...baseMsgInstantiateContract } as MsgInstantiateContract; message.initFunds = []; if (object.sender !== undefined && object.sender !== null) { message.sender = String(object.sender); @@ -366,6 +386,22 @@ export const MsgInstantiateContract = { return message; }, + toJSON(message: MsgInstantiateContract): unknown { + const obj: any = {}; + message.sender !== undefined && (obj.sender = message.sender); + message.admin !== undefined && (obj.admin = message.admin); + message.codeId !== undefined && (obj.codeId = (message.codeId || Long.UZERO).toString()); + message.label !== undefined && (obj.label = message.label); + message.initMsg !== undefined && + (obj.initMsg = base64FromBytes(message.initMsg !== undefined ? message.initMsg : new Uint8Array())); + if (message.initFunds) { + obj.initFunds = message.initFunds.map((e) => (e ? Coin.toJSON(e) : undefined)); + } else { + obj.initFunds = []; + } + return obj; + }, + fromPartial(object: DeepPartial): MsgInstantiateContract { const message = { ...baseMsgInstantiateContract } as MsgInstantiateContract; message.initFunds = []; @@ -401,36 +437,22 @@ export const MsgInstantiateContract = { } return message; }, - - toJSON(message: MsgInstantiateContract): unknown { - const obj: any = {}; - message.sender !== undefined && (obj.sender = message.sender); - message.admin !== undefined && (obj.admin = message.admin); - message.codeId !== undefined && (obj.codeId = (message.codeId || Long.UZERO).toString()); - message.label !== undefined && (obj.label = message.label); - message.initMsg !== undefined && - (obj.initMsg = base64FromBytes(message.initMsg !== undefined ? message.initMsg : new Uint8Array())); - if (message.initFunds) { - obj.initFunds = message.initFunds.map((e) => (e ? Coin.toJSON(e) : undefined)); - } else { - obj.initFunds = []; - } - return obj; - }, }; const baseMsgInstantiateContractResponse: object = { address: "" }; export const MsgInstantiateContractResponse = { encode(message: MsgInstantiateContractResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.address); + if (message.address !== "") { + writer.uint32(10).string(message.address); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgInstantiateContractResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseMsgInstantiateContractResponse) as MsgInstantiateContractResponse; + const message = { ...baseMsgInstantiateContractResponse } as MsgInstantiateContractResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -446,19 +468,9 @@ export const MsgInstantiateContractResponse = { }, fromJSON(object: any): MsgInstantiateContractResponse { - const message = Object.create(baseMsgInstantiateContractResponse) as MsgInstantiateContractResponse; - if (object.address !== undefined && object.address !== null) { - message.address = String(object.address); - } else { - message.address = ""; - } - return message; - }, - - fromPartial(object: DeepPartial): MsgInstantiateContractResponse { const message = { ...baseMsgInstantiateContractResponse } as MsgInstantiateContractResponse; if (object.address !== undefined && object.address !== null) { - message.address = object.address; + message.address = String(object.address); } else { message.address = ""; } @@ -470,15 +482,31 @@ export const MsgInstantiateContractResponse = { message.address !== undefined && (obj.address = message.address); return obj; }, + + fromPartial(object: DeepPartial): MsgInstantiateContractResponse { + const message = { ...baseMsgInstantiateContractResponse } as MsgInstantiateContractResponse; + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } else { + message.address = ""; + } + return message; + }, }; const baseMsgExecuteContract: object = { sender: "", contract: "" }; export const MsgExecuteContract = { encode(message: MsgExecuteContract, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.sender); - writer.uint32(18).string(message.contract); - writer.uint32(26).bytes(message.msg); + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.contract !== "") { + writer.uint32(18).string(message.contract); + } + if (message.msg.length !== 0) { + writer.uint32(26).bytes(message.msg); + } for (const v of message.sentFunds) { Coin.encode(v!, writer.uint32(42).fork()).ldelim(); } @@ -488,7 +516,7 @@ export const MsgExecuteContract = { decode(input: _m0.Reader | Uint8Array, length?: number): MsgExecuteContract { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseMsgExecuteContract) as MsgExecuteContract; + const message = { ...baseMsgExecuteContract } as MsgExecuteContract; message.sentFunds = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -514,7 +542,7 @@ export const MsgExecuteContract = { }, fromJSON(object: any): MsgExecuteContract { - const message = Object.create(baseMsgExecuteContract) as MsgExecuteContract; + const message = { ...baseMsgExecuteContract } as MsgExecuteContract; message.sentFunds = []; if (object.sender !== undefined && object.sender !== null) { message.sender = String(object.sender); @@ -537,6 +565,20 @@ export const MsgExecuteContract = { return message; }, + toJSON(message: MsgExecuteContract): unknown { + const obj: any = {}; + message.sender !== undefined && (obj.sender = message.sender); + message.contract !== undefined && (obj.contract = message.contract); + message.msg !== undefined && + (obj.msg = base64FromBytes(message.msg !== undefined ? message.msg : new Uint8Array())); + if (message.sentFunds) { + obj.sentFunds = message.sentFunds.map((e) => (e ? Coin.toJSON(e) : undefined)); + } else { + obj.sentFunds = []; + } + return obj; + }, + fromPartial(object: DeepPartial): MsgExecuteContract { const message = { ...baseMsgExecuteContract } as MsgExecuteContract; message.sentFunds = []; @@ -562,34 +604,22 @@ export const MsgExecuteContract = { } return message; }, - - toJSON(message: MsgExecuteContract): unknown { - const obj: any = {}; - message.sender !== undefined && (obj.sender = message.sender); - message.contract !== undefined && (obj.contract = message.contract); - message.msg !== undefined && - (obj.msg = base64FromBytes(message.msg !== undefined ? message.msg : new Uint8Array())); - if (message.sentFunds) { - obj.sentFunds = message.sentFunds.map((e) => (e ? Coin.toJSON(e) : undefined)); - } else { - obj.sentFunds = []; - } - return obj; - }, }; const baseMsgExecuteContractResponse: object = {}; export const MsgExecuteContractResponse = { encode(message: MsgExecuteContractResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).bytes(message.data); + if (message.data.length !== 0) { + writer.uint32(10).bytes(message.data); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgExecuteContractResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseMsgExecuteContractResponse) as MsgExecuteContractResponse; + const message = { ...baseMsgExecuteContractResponse } as MsgExecuteContractResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -605,13 +635,20 @@ export const MsgExecuteContractResponse = { }, fromJSON(object: any): MsgExecuteContractResponse { - const message = Object.create(baseMsgExecuteContractResponse) as MsgExecuteContractResponse; + const message = { ...baseMsgExecuteContractResponse } as MsgExecuteContractResponse; if (object.data !== undefined && object.data !== null) { message.data = bytesFromBase64(object.data); } return message; }, + toJSON(message: MsgExecuteContractResponse): unknown { + const obj: any = {}; + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); + return obj; + }, + fromPartial(object: DeepPartial): MsgExecuteContractResponse { const message = { ...baseMsgExecuteContractResponse } as MsgExecuteContractResponse; if (object.data !== undefined && object.data !== null) { @@ -621,30 +658,31 @@ export const MsgExecuteContractResponse = { } return message; }, - - toJSON(message: MsgExecuteContractResponse): unknown { - const obj: any = {}; - message.data !== undefined && - (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); - return obj; - }, }; const baseMsgMigrateContract: object = { sender: "", contract: "", codeId: Long.UZERO }; export const MsgMigrateContract = { encode(message: MsgMigrateContract, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.sender); - writer.uint32(18).string(message.contract); - writer.uint32(24).uint64(message.codeId); - writer.uint32(34).bytes(message.migrateMsg); + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.contract !== "") { + writer.uint32(18).string(message.contract); + } + if (!message.codeId.isZero()) { + writer.uint32(24).uint64(message.codeId); + } + if (message.migrateMsg.length !== 0) { + writer.uint32(34).bytes(message.migrateMsg); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgMigrateContract { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseMsgMigrateContract) as MsgMigrateContract; + const message = { ...baseMsgMigrateContract } as MsgMigrateContract; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -669,7 +707,7 @@ export const MsgMigrateContract = { }, fromJSON(object: any): MsgMigrateContract { - const message = Object.create(baseMsgMigrateContract) as MsgMigrateContract; + const message = { ...baseMsgMigrateContract } as MsgMigrateContract; if (object.sender !== undefined && object.sender !== null) { message.sender = String(object.sender); } else { @@ -691,6 +729,18 @@ export const MsgMigrateContract = { return message; }, + toJSON(message: MsgMigrateContract): unknown { + const obj: any = {}; + message.sender !== undefined && (obj.sender = message.sender); + message.contract !== undefined && (obj.contract = message.contract); + message.codeId !== undefined && (obj.codeId = (message.codeId || Long.UZERO).toString()); + message.migrateMsg !== undefined && + (obj.migrateMsg = base64FromBytes( + message.migrateMsg !== undefined ? message.migrateMsg : new Uint8Array(), + )); + return obj; + }, + fromPartial(object: DeepPartial): MsgMigrateContract { const message = { ...baseMsgMigrateContract } as MsgMigrateContract; if (object.sender !== undefined && object.sender !== null) { @@ -715,32 +765,22 @@ export const MsgMigrateContract = { } return message; }, - - toJSON(message: MsgMigrateContract): unknown { - const obj: any = {}; - message.sender !== undefined && (obj.sender = message.sender); - message.contract !== undefined && (obj.contract = message.contract); - message.codeId !== undefined && (obj.codeId = (message.codeId || Long.UZERO).toString()); - message.migrateMsg !== undefined && - (obj.migrateMsg = base64FromBytes( - message.migrateMsg !== undefined ? message.migrateMsg : new Uint8Array(), - )); - return obj; - }, }; const baseMsgMigrateContractResponse: object = {}; export const MsgMigrateContractResponse = { encode(message: MsgMigrateContractResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).bytes(message.data); + if (message.data.length !== 0) { + writer.uint32(10).bytes(message.data); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgMigrateContractResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseMsgMigrateContractResponse) as MsgMigrateContractResponse; + const message = { ...baseMsgMigrateContractResponse } as MsgMigrateContractResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -756,13 +796,20 @@ export const MsgMigrateContractResponse = { }, fromJSON(object: any): MsgMigrateContractResponse { - const message = Object.create(baseMsgMigrateContractResponse) as MsgMigrateContractResponse; + const message = { ...baseMsgMigrateContractResponse } as MsgMigrateContractResponse; if (object.data !== undefined && object.data !== null) { message.data = bytesFromBase64(object.data); } return message; }, + toJSON(message: MsgMigrateContractResponse): unknown { + const obj: any = {}; + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); + return obj; + }, + fromPartial(object: DeepPartial): MsgMigrateContractResponse { const message = { ...baseMsgMigrateContractResponse } as MsgMigrateContractResponse; if (object.data !== undefined && object.data !== null) { @@ -772,29 +819,28 @@ export const MsgMigrateContractResponse = { } return message; }, - - toJSON(message: MsgMigrateContractResponse): unknown { - const obj: any = {}; - message.data !== undefined && - (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); - return obj; - }, }; const baseMsgUpdateAdmin: object = { sender: "", newAdmin: "", contract: "" }; export const MsgUpdateAdmin = { encode(message: MsgUpdateAdmin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.sender); - writer.uint32(18).string(message.newAdmin); - writer.uint32(26).string(message.contract); + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.newAdmin !== "") { + writer.uint32(18).string(message.newAdmin); + } + if (message.contract !== "") { + writer.uint32(26).string(message.contract); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateAdmin { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseMsgUpdateAdmin) as MsgUpdateAdmin; + const message = { ...baseMsgUpdateAdmin } as MsgUpdateAdmin; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -816,7 +862,7 @@ export const MsgUpdateAdmin = { }, fromJSON(object: any): MsgUpdateAdmin { - const message = Object.create(baseMsgUpdateAdmin) as MsgUpdateAdmin; + const message = { ...baseMsgUpdateAdmin } as MsgUpdateAdmin; if (object.sender !== undefined && object.sender !== null) { message.sender = String(object.sender); } else { @@ -835,6 +881,14 @@ export const MsgUpdateAdmin = { return message; }, + toJSON(message: MsgUpdateAdmin): unknown { + const obj: any = {}; + message.sender !== undefined && (obj.sender = message.sender); + message.newAdmin !== undefined && (obj.newAdmin = message.newAdmin); + message.contract !== undefined && (obj.contract = message.contract); + return obj; + }, + fromPartial(object: DeepPartial): MsgUpdateAdmin { const message = { ...baseMsgUpdateAdmin } as MsgUpdateAdmin; if (object.sender !== undefined && object.sender !== null) { @@ -854,14 +908,6 @@ export const MsgUpdateAdmin = { } return message; }, - - toJSON(message: MsgUpdateAdmin): unknown { - const obj: any = {}; - message.sender !== undefined && (obj.sender = message.sender); - message.newAdmin !== undefined && (obj.newAdmin = message.newAdmin); - message.contract !== undefined && (obj.contract = message.contract); - return obj; - }, }; const baseMsgUpdateAdminResponse: object = {}; @@ -874,7 +920,7 @@ export const MsgUpdateAdminResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateAdminResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseMsgUpdateAdminResponse) as MsgUpdateAdminResponse; + const message = { ...baseMsgUpdateAdminResponse } as MsgUpdateAdminResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -887,11 +933,6 @@ export const MsgUpdateAdminResponse = { }, fromJSON(_: any): MsgUpdateAdminResponse { - const message = Object.create(baseMsgUpdateAdminResponse) as MsgUpdateAdminResponse; - return message; - }, - - fromPartial(_: DeepPartial): MsgUpdateAdminResponse { const message = { ...baseMsgUpdateAdminResponse } as MsgUpdateAdminResponse; return message; }, @@ -900,21 +941,30 @@ export const MsgUpdateAdminResponse = { const obj: any = {}; return obj; }, + + fromPartial(_: DeepPartial): MsgUpdateAdminResponse { + const message = { ...baseMsgUpdateAdminResponse } as MsgUpdateAdminResponse; + return message; + }, }; const baseMsgClearAdmin: object = { sender: "", contract: "" }; export const MsgClearAdmin = { encode(message: MsgClearAdmin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.sender); - writer.uint32(26).string(message.contract); + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.contract !== "") { + writer.uint32(26).string(message.contract); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgClearAdmin { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseMsgClearAdmin) as MsgClearAdmin; + const message = { ...baseMsgClearAdmin } as MsgClearAdmin; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -933,7 +983,7 @@ export const MsgClearAdmin = { }, fromJSON(object: any): MsgClearAdmin { - const message = Object.create(baseMsgClearAdmin) as MsgClearAdmin; + const message = { ...baseMsgClearAdmin } as MsgClearAdmin; if (object.sender !== undefined && object.sender !== null) { message.sender = String(object.sender); } else { @@ -947,6 +997,13 @@ export const MsgClearAdmin = { return message; }, + toJSON(message: MsgClearAdmin): unknown { + const obj: any = {}; + message.sender !== undefined && (obj.sender = message.sender); + message.contract !== undefined && (obj.contract = message.contract); + return obj; + }, + fromPartial(object: DeepPartial): MsgClearAdmin { const message = { ...baseMsgClearAdmin } as MsgClearAdmin; if (object.sender !== undefined && object.sender !== null) { @@ -961,13 +1018,6 @@ export const MsgClearAdmin = { } return message; }, - - toJSON(message: MsgClearAdmin): unknown { - const obj: any = {}; - message.sender !== undefined && (obj.sender = message.sender); - message.contract !== undefined && (obj.contract = message.contract); - return obj; - }, }; const baseMsgClearAdminResponse: object = {}; @@ -980,7 +1030,7 @@ export const MsgClearAdminResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): MsgClearAdminResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseMsgClearAdminResponse) as MsgClearAdminResponse; + const message = { ...baseMsgClearAdminResponse } as MsgClearAdminResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -993,11 +1043,6 @@ export const MsgClearAdminResponse = { }, fromJSON(_: any): MsgClearAdminResponse { - const message = Object.create(baseMsgClearAdminResponse) as MsgClearAdminResponse; - return message; - }, - - fromPartial(_: DeepPartial): MsgClearAdminResponse { const message = { ...baseMsgClearAdminResponse } as MsgClearAdminResponse; return message; }, @@ -1006,6 +1051,11 @@ export const MsgClearAdminResponse = { const obj: any = {}; return obj; }, + + fromPartial(_: DeepPartial): MsgClearAdminResponse { + const message = { ...baseMsgClearAdminResponse } as MsgClearAdminResponse; + return message; + }, }; /** Msg defines the wasm Msg service. */ @@ -1077,7 +1127,7 @@ var globalThis: any = (() => { if (typeof self !== "undefined") return self; if (typeof window !== "undefined") return window; if (typeof global !== "undefined") return global; - throw new Error("Unable to locate global object"); + throw "Unable to locate global object"; })(); const atob: (b64: string) => string = diff --git a/packages/cosmwasm-stargate/src/codec/x/wasm/internal/types/types.ts b/packages/cosmwasm-stargate/src/codec/x/wasm/internal/types/types.ts index 10f2944a..e9e3b7c6 100644 --- a/packages/cosmwasm-stargate/src/codec/x/wasm/internal/types/types.ts +++ b/packages/cosmwasm-stargate/src/codec/x/wasm/internal/types/types.ts @@ -181,14 +181,16 @@ const baseAccessTypeParam: object = { value: 0 }; export const AccessTypeParam = { encode(message: AccessTypeParam, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).int32(message.value); + if (message.value !== 0) { + writer.uint32(8).int32(message.value); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): AccessTypeParam { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseAccessTypeParam) as AccessTypeParam; + const message = { ...baseAccessTypeParam } as AccessTypeParam; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -204,19 +206,9 @@ export const AccessTypeParam = { }, fromJSON(object: any): AccessTypeParam { - const message = Object.create(baseAccessTypeParam) as AccessTypeParam; - if (object.value !== undefined && object.value !== null) { - message.value = accessTypeFromJSON(object.value); - } else { - message.value = 0; - } - return message; - }, - - fromPartial(object: DeepPartial): AccessTypeParam { const message = { ...baseAccessTypeParam } as AccessTypeParam; if (object.value !== undefined && object.value !== null) { - message.value = object.value; + message.value = accessTypeFromJSON(object.value); } else { message.value = 0; } @@ -228,21 +220,35 @@ export const AccessTypeParam = { message.value !== undefined && (obj.value = accessTypeToJSON(message.value)); return obj; }, + + fromPartial(object: DeepPartial): AccessTypeParam { + const message = { ...baseAccessTypeParam } as AccessTypeParam; + if (object.value !== undefined && object.value !== null) { + message.value = object.value; + } else { + message.value = 0; + } + return message; + }, }; const baseAccessConfig: object = { permission: 0, address: "" }; export const AccessConfig = { encode(message: AccessConfig, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).int32(message.permission); - writer.uint32(18).string(message.address); + if (message.permission !== 0) { + writer.uint32(8).int32(message.permission); + } + if (message.address !== "") { + writer.uint32(18).string(message.address); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): AccessConfig { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseAccessConfig) as AccessConfig; + const message = { ...baseAccessConfig } as AccessConfig; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -261,7 +267,7 @@ export const AccessConfig = { }, fromJSON(object: any): AccessConfig { - const message = Object.create(baseAccessConfig) as AccessConfig; + const message = { ...baseAccessConfig } as AccessConfig; if (object.permission !== undefined && object.permission !== null) { message.permission = accessTypeFromJSON(object.permission); } else { @@ -275,6 +281,13 @@ export const AccessConfig = { return message; }, + toJSON(message: AccessConfig): unknown { + const obj: any = {}; + message.permission !== undefined && (obj.permission = accessTypeToJSON(message.permission)); + message.address !== undefined && (obj.address = message.address); + return obj; + }, + fromPartial(object: DeepPartial): AccessConfig { const message = { ...baseAccessConfig } as AccessConfig; if (object.permission !== undefined && object.permission !== null) { @@ -289,13 +302,6 @@ export const AccessConfig = { } return message; }, - - toJSON(message: AccessConfig): unknown { - const obj: any = {}; - message.permission !== undefined && (obj.permission = accessTypeToJSON(message.permission)); - message.address !== undefined && (obj.address = message.address); - return obj; - }, }; const baseParams: object = { instantiateDefaultPermission: 0, maxWasmCodeSize: Long.UZERO }; @@ -305,15 +311,19 @@ export const Params = { if (message.codeUploadAccess !== undefined) { AccessConfig.encode(message.codeUploadAccess, writer.uint32(10).fork()).ldelim(); } - writer.uint32(16).int32(message.instantiateDefaultPermission); - writer.uint32(24).uint64(message.maxWasmCodeSize); + if (message.instantiateDefaultPermission !== 0) { + writer.uint32(16).int32(message.instantiateDefaultPermission); + } + if (!message.maxWasmCodeSize.isZero()) { + writer.uint32(24).uint64(message.maxWasmCodeSize); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): Params { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseParams) as Params; + const message = { ...baseParams } as Params; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -335,7 +345,7 @@ export const Params = { }, fromJSON(object: any): Params { - const message = Object.create(baseParams) as Params; + const message = { ...baseParams } as Params; if (object.codeUploadAccess !== undefined && object.codeUploadAccess !== null) { message.codeUploadAccess = AccessConfig.fromJSON(object.codeUploadAccess); } else { @@ -354,6 +364,19 @@ export const Params = { return message; }, + toJSON(message: Params): unknown { + const obj: any = {}; + message.codeUploadAccess !== undefined && + (obj.codeUploadAccess = message.codeUploadAccess + ? AccessConfig.toJSON(message.codeUploadAccess) + : undefined); + message.instantiateDefaultPermission !== undefined && + (obj.instantiateDefaultPermission = accessTypeToJSON(message.instantiateDefaultPermission)); + message.maxWasmCodeSize !== undefined && + (obj.maxWasmCodeSize = (message.maxWasmCodeSize || Long.UZERO).toString()); + return obj; + }, + fromPartial(object: DeepPartial): Params { const message = { ...baseParams } as Params; if (object.codeUploadAccess !== undefined && object.codeUploadAccess !== null) { @@ -373,29 +396,24 @@ export const Params = { } return message; }, - - toJSON(message: Params): unknown { - const obj: any = {}; - message.codeUploadAccess !== undefined && - (obj.codeUploadAccess = message.codeUploadAccess - ? AccessConfig.toJSON(message.codeUploadAccess) - : undefined); - message.instantiateDefaultPermission !== undefined && - (obj.instantiateDefaultPermission = accessTypeToJSON(message.instantiateDefaultPermission)); - message.maxWasmCodeSize !== undefined && - (obj.maxWasmCodeSize = (message.maxWasmCodeSize || Long.UZERO).toString()); - return obj; - }, }; const baseCodeInfo: object = { creator: "", source: "", builder: "" }; export const CodeInfo = { encode(message: CodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).bytes(message.codeHash); - writer.uint32(18).string(message.creator); - writer.uint32(26).string(message.source); - writer.uint32(34).string(message.builder); + if (message.codeHash.length !== 0) { + writer.uint32(10).bytes(message.codeHash); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.source !== "") { + writer.uint32(26).string(message.source); + } + if (message.builder !== "") { + writer.uint32(34).string(message.builder); + } if (message.instantiateConfig !== undefined) { AccessConfig.encode(message.instantiateConfig, writer.uint32(42).fork()).ldelim(); } @@ -405,7 +423,7 @@ export const CodeInfo = { decode(input: _m0.Reader | Uint8Array, length?: number): CodeInfo { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseCodeInfo) as CodeInfo; + const message = { ...baseCodeInfo } as CodeInfo; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -433,7 +451,7 @@ export const CodeInfo = { }, fromJSON(object: any): CodeInfo { - const message = Object.create(baseCodeInfo) as CodeInfo; + const message = { ...baseCodeInfo } as CodeInfo; if (object.codeHash !== undefined && object.codeHash !== null) { message.codeHash = bytesFromBase64(object.codeHash); } @@ -460,6 +478,20 @@ export const CodeInfo = { return message; }, + toJSON(message: CodeInfo): unknown { + const obj: any = {}; + message.codeHash !== undefined && + (obj.codeHash = base64FromBytes(message.codeHash !== undefined ? message.codeHash : new Uint8Array())); + message.creator !== undefined && (obj.creator = message.creator); + message.source !== undefined && (obj.source = message.source); + message.builder !== undefined && (obj.builder = message.builder); + message.instantiateConfig !== undefined && + (obj.instantiateConfig = message.instantiateConfig + ? AccessConfig.toJSON(message.instantiateConfig) + : undefined); + return obj; + }, + fromPartial(object: DeepPartial): CodeInfo { const message = { ...baseCodeInfo } as CodeInfo; if (object.codeHash !== undefined && object.codeHash !== null) { @@ -489,30 +521,24 @@ export const CodeInfo = { } return message; }, - - toJSON(message: CodeInfo): unknown { - const obj: any = {}; - message.codeHash !== undefined && - (obj.codeHash = base64FromBytes(message.codeHash !== undefined ? message.codeHash : new Uint8Array())); - message.creator !== undefined && (obj.creator = message.creator); - message.source !== undefined && (obj.source = message.source); - message.builder !== undefined && (obj.builder = message.builder); - message.instantiateConfig !== undefined && - (obj.instantiateConfig = message.instantiateConfig - ? AccessConfig.toJSON(message.instantiateConfig) - : undefined); - return obj; - }, }; const baseContractInfo: object = { codeId: Long.UZERO, creator: "", admin: "", label: "" }; export const ContractInfo = { encode(message: ContractInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).uint64(message.codeId); - writer.uint32(18).string(message.creator); - writer.uint32(26).string(message.admin); - writer.uint32(34).string(message.label); + if (!message.codeId.isZero()) { + writer.uint32(8).uint64(message.codeId); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.admin !== "") { + writer.uint32(26).string(message.admin); + } + if (message.label !== "") { + writer.uint32(34).string(message.label); + } if (message.created !== undefined) { AbsoluteTxPosition.encode(message.created, writer.uint32(42).fork()).ldelim(); } @@ -522,7 +548,7 @@ export const ContractInfo = { decode(input: _m0.Reader | Uint8Array, length?: number): ContractInfo { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseContractInfo) as ContractInfo; + const message = { ...baseContractInfo } as ContractInfo; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -550,7 +576,7 @@ export const ContractInfo = { }, fromJSON(object: any): ContractInfo { - const message = Object.create(baseContractInfo) as ContractInfo; + const message = { ...baseContractInfo } as ContractInfo; if (object.codeId !== undefined && object.codeId !== null) { message.codeId = Long.fromString(object.codeId); } else { @@ -579,6 +605,17 @@ export const ContractInfo = { return message; }, + toJSON(message: ContractInfo): unknown { + const obj: any = {}; + message.codeId !== undefined && (obj.codeId = (message.codeId || Long.UZERO).toString()); + message.creator !== undefined && (obj.creator = message.creator); + message.admin !== undefined && (obj.admin = message.admin); + message.label !== undefined && (obj.label = message.label); + message.created !== undefined && + (obj.created = message.created ? AbsoluteTxPosition.toJSON(message.created) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): ContractInfo { const message = { ...baseContractInfo } as ContractInfo; if (object.codeId !== undefined && object.codeId !== null) { @@ -608,36 +645,31 @@ export const ContractInfo = { } return message; }, - - toJSON(message: ContractInfo): unknown { - const obj: any = {}; - message.codeId !== undefined && (obj.codeId = (message.codeId || Long.UZERO).toString()); - message.creator !== undefined && (obj.creator = message.creator); - message.admin !== undefined && (obj.admin = message.admin); - message.label !== undefined && (obj.label = message.label); - message.created !== undefined && - (obj.created = message.created ? AbsoluteTxPosition.toJSON(message.created) : undefined); - return obj; - }, }; const baseContractCodeHistoryEntry: object = { operation: 0, codeId: Long.UZERO }; export const ContractCodeHistoryEntry = { encode(message: ContractCodeHistoryEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).int32(message.operation); - writer.uint32(16).uint64(message.codeId); + if (message.operation !== 0) { + writer.uint32(8).int32(message.operation); + } + if (!message.codeId.isZero()) { + writer.uint32(16).uint64(message.codeId); + } if (message.updated !== undefined) { AbsoluteTxPosition.encode(message.updated, writer.uint32(26).fork()).ldelim(); } - writer.uint32(34).bytes(message.msg); + if (message.msg.length !== 0) { + writer.uint32(34).bytes(message.msg); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): ContractCodeHistoryEntry { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseContractCodeHistoryEntry) as ContractCodeHistoryEntry; + const message = { ...baseContractCodeHistoryEntry } as ContractCodeHistoryEntry; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -662,7 +694,7 @@ export const ContractCodeHistoryEntry = { }, fromJSON(object: any): ContractCodeHistoryEntry { - const message = Object.create(baseContractCodeHistoryEntry) as ContractCodeHistoryEntry; + const message = { ...baseContractCodeHistoryEntry } as ContractCodeHistoryEntry; if (object.operation !== undefined && object.operation !== null) { message.operation = contractCodeHistoryOperationTypeFromJSON(object.operation); } else { @@ -684,6 +716,18 @@ export const ContractCodeHistoryEntry = { return message; }, + toJSON(message: ContractCodeHistoryEntry): unknown { + const obj: any = {}; + message.operation !== undefined && + (obj.operation = contractCodeHistoryOperationTypeToJSON(message.operation)); + message.codeId !== undefined && (obj.codeId = (message.codeId || Long.UZERO).toString()); + message.updated !== undefined && + (obj.updated = message.updated ? AbsoluteTxPosition.toJSON(message.updated) : undefined); + message.msg !== undefined && + (obj.msg = base64FromBytes(message.msg !== undefined ? message.msg : new Uint8Array())); + return obj; + }, + fromPartial(object: DeepPartial): ContractCodeHistoryEntry { const message = { ...baseContractCodeHistoryEntry } as ContractCodeHistoryEntry; if (object.operation !== undefined && object.operation !== null) { @@ -708,33 +752,25 @@ export const ContractCodeHistoryEntry = { } return message; }, - - toJSON(message: ContractCodeHistoryEntry): unknown { - const obj: any = {}; - message.operation !== undefined && - (obj.operation = contractCodeHistoryOperationTypeToJSON(message.operation)); - message.codeId !== undefined && (obj.codeId = (message.codeId || Long.UZERO).toString()); - message.updated !== undefined && - (obj.updated = message.updated ? AbsoluteTxPosition.toJSON(message.updated) : undefined); - message.msg !== undefined && - (obj.msg = base64FromBytes(message.msg !== undefined ? message.msg : new Uint8Array())); - return obj; - }, }; const baseAbsoluteTxPosition: object = { blockHeight: Long.UZERO, txIndex: Long.UZERO }; export const AbsoluteTxPosition = { encode(message: AbsoluteTxPosition, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).uint64(message.blockHeight); - writer.uint32(16).uint64(message.txIndex); + if (!message.blockHeight.isZero()) { + writer.uint32(8).uint64(message.blockHeight); + } + if (!message.txIndex.isZero()) { + writer.uint32(16).uint64(message.txIndex); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): AbsoluteTxPosition { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseAbsoluteTxPosition) as AbsoluteTxPosition; + const message = { ...baseAbsoluteTxPosition } as AbsoluteTxPosition; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -753,7 +789,7 @@ export const AbsoluteTxPosition = { }, fromJSON(object: any): AbsoluteTxPosition { - const message = Object.create(baseAbsoluteTxPosition) as AbsoluteTxPosition; + const message = { ...baseAbsoluteTxPosition } as AbsoluteTxPosition; if (object.blockHeight !== undefined && object.blockHeight !== null) { message.blockHeight = Long.fromString(object.blockHeight); } else { @@ -767,6 +803,13 @@ export const AbsoluteTxPosition = { return message; }, + toJSON(message: AbsoluteTxPosition): unknown { + const obj: any = {}; + message.blockHeight !== undefined && (obj.blockHeight = (message.blockHeight || Long.UZERO).toString()); + message.txIndex !== undefined && (obj.txIndex = (message.txIndex || Long.UZERO).toString()); + return obj; + }, + fromPartial(object: DeepPartial): AbsoluteTxPosition { const message = { ...baseAbsoluteTxPosition } as AbsoluteTxPosition; if (object.blockHeight !== undefined && object.blockHeight !== null) { @@ -781,28 +824,25 @@ export const AbsoluteTxPosition = { } return message; }, - - toJSON(message: AbsoluteTxPosition): unknown { - const obj: any = {}; - message.blockHeight !== undefined && (obj.blockHeight = (message.blockHeight || Long.UZERO).toString()); - message.txIndex !== undefined && (obj.txIndex = (message.txIndex || Long.UZERO).toString()); - return obj; - }, }; const baseModel: object = {}; export const Model = { encode(message: Model, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).bytes(message.key); - writer.uint32(18).bytes(message.value); + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): Model { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseModel) as Model; + const message = { ...baseModel } as Model; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -821,7 +861,7 @@ export const Model = { }, fromJSON(object: any): Model { - const message = Object.create(baseModel) as Model; + const message = { ...baseModel } as Model; if (object.key !== undefined && object.key !== null) { message.key = bytesFromBase64(object.key); } @@ -831,6 +871,15 @@ export const Model = { return message; }, + toJSON(message: Model): unknown { + const obj: any = {}; + message.key !== undefined && + (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); + message.value !== undefined && + (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); + return obj; + }, + fromPartial(object: DeepPartial): Model { const message = { ...baseModel } as Model; if (object.key !== undefined && object.key !== null) { @@ -845,15 +894,6 @@ export const Model = { } return message; }, - - toJSON(message: Model): unknown { - const obj: any = {}; - message.key !== undefined && - (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); - message.value !== undefined && - (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); - return obj; - }, }; declare var self: any | undefined; @@ -863,7 +903,7 @@ var globalThis: any = (() => { if (typeof self !== "undefined") return self; if (typeof window !== "undefined") return window; if (typeof global !== "undefined") return global; - throw new Error("Unable to locate global object"); + throw "Unable to locate global object"; })(); const atob: (b64: string) => string = diff --git a/packages/proto-signing/src/codec/cosmos/bank/v1beta1/bank.ts b/packages/proto-signing/src/codec/cosmos/bank/v1beta1/bank.ts index 7c2e0e02..43fa84f5 100644 --- a/packages/proto-signing/src/codec/cosmos/bank/v1beta1/bank.ts +++ b/packages/proto-signing/src/codec/cosmos/bank/v1beta1/bank.ts @@ -83,14 +83,16 @@ export const Params = { for (const v of message.sendEnabled) { SendEnabled.encode(v!, writer.uint32(10).fork()).ldelim(); } - writer.uint32(16).bool(message.defaultSendEnabled); + if (message.defaultSendEnabled === true) { + writer.uint32(16).bool(message.defaultSendEnabled); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): Params { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseParams) as Params; + const message = { ...baseParams } as Params; message.sendEnabled = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -110,7 +112,7 @@ export const Params = { }, fromJSON(object: any): Params { - const message = Object.create(baseParams) as Params; + const message = { ...baseParams } as Params; message.sendEnabled = []; if (object.sendEnabled !== undefined && object.sendEnabled !== null) { for (const e of object.sendEnabled) { @@ -125,6 +127,17 @@ export const Params = { return message; }, + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.sendEnabled) { + obj.sendEnabled = message.sendEnabled.map((e) => (e ? SendEnabled.toJSON(e) : undefined)); + } else { + obj.sendEnabled = []; + } + message.defaultSendEnabled !== undefined && (obj.defaultSendEnabled = message.defaultSendEnabled); + return obj; + }, + fromPartial(object: DeepPartial): Params { const message = { ...baseParams } as Params; message.sendEnabled = []; @@ -140,32 +153,25 @@ export const Params = { } return message; }, - - toJSON(message: Params): unknown { - const obj: any = {}; - if (message.sendEnabled) { - obj.sendEnabled = message.sendEnabled.map((e) => (e ? SendEnabled.toJSON(e) : undefined)); - } else { - obj.sendEnabled = []; - } - message.defaultSendEnabled !== undefined && (obj.defaultSendEnabled = message.defaultSendEnabled); - return obj; - }, }; const baseSendEnabled: object = { denom: "", enabled: false }; export const SendEnabled = { encode(message: SendEnabled, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.denom); - writer.uint32(16).bool(message.enabled); + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.enabled === true) { + writer.uint32(16).bool(message.enabled); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): SendEnabled { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseSendEnabled) as SendEnabled; + const message = { ...baseSendEnabled } as SendEnabled; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -184,7 +190,7 @@ export const SendEnabled = { }, fromJSON(object: any): SendEnabled { - const message = Object.create(baseSendEnabled) as SendEnabled; + const message = { ...baseSendEnabled } as SendEnabled; if (object.denom !== undefined && object.denom !== null) { message.denom = String(object.denom); } else { @@ -198,6 +204,13 @@ export const SendEnabled = { return message; }, + toJSON(message: SendEnabled): unknown { + const obj: any = {}; + message.denom !== undefined && (obj.denom = message.denom); + message.enabled !== undefined && (obj.enabled = message.enabled); + return obj; + }, + fromPartial(object: DeepPartial): SendEnabled { const message = { ...baseSendEnabled } as SendEnabled; if (object.denom !== undefined && object.denom !== null) { @@ -212,20 +225,15 @@ export const SendEnabled = { } return message; }, - - toJSON(message: SendEnabled): unknown { - const obj: any = {}; - message.denom !== undefined && (obj.denom = message.denom); - message.enabled !== undefined && (obj.enabled = message.enabled); - return obj; - }, }; const baseInput: object = { address: "" }; export const Input = { encode(message: Input, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.address); + if (message.address !== "") { + writer.uint32(10).string(message.address); + } for (const v of message.coins) { Coin.encode(v!, writer.uint32(18).fork()).ldelim(); } @@ -235,7 +243,7 @@ export const Input = { decode(input: _m0.Reader | Uint8Array, length?: number): Input { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseInput) as Input; + const message = { ...baseInput } as Input; message.coins = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -255,7 +263,7 @@ export const Input = { }, fromJSON(object: any): Input { - const message = Object.create(baseInput) as Input; + const message = { ...baseInput } as Input; message.coins = []; if (object.address !== undefined && object.address !== null) { message.address = String(object.address); @@ -270,6 +278,17 @@ export const Input = { return message; }, + toJSON(message: Input): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + if (message.coins) { + obj.coins = message.coins.map((e) => (e ? Coin.toJSON(e) : undefined)); + } else { + obj.coins = []; + } + return obj; + }, + fromPartial(object: DeepPartial): Input { const message = { ...baseInput } as Input; message.coins = []; @@ -285,24 +304,15 @@ export const Input = { } return message; }, - - toJSON(message: Input): unknown { - const obj: any = {}; - message.address !== undefined && (obj.address = message.address); - if (message.coins) { - obj.coins = message.coins.map((e) => (e ? Coin.toJSON(e) : undefined)); - } else { - obj.coins = []; - } - return obj; - }, }; const baseOutput: object = { address: "" }; export const Output = { encode(message: Output, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.address); + if (message.address !== "") { + writer.uint32(10).string(message.address); + } for (const v of message.coins) { Coin.encode(v!, writer.uint32(18).fork()).ldelim(); } @@ -312,7 +322,7 @@ export const Output = { decode(input: _m0.Reader | Uint8Array, length?: number): Output { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseOutput) as Output; + const message = { ...baseOutput } as Output; message.coins = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -332,7 +342,7 @@ export const Output = { }, fromJSON(object: any): Output { - const message = Object.create(baseOutput) as Output; + const message = { ...baseOutput } as Output; message.coins = []; if (object.address !== undefined && object.address !== null) { message.address = String(object.address); @@ -347,6 +357,17 @@ export const Output = { return message; }, + toJSON(message: Output): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + if (message.coins) { + obj.coins = message.coins.map((e) => (e ? Coin.toJSON(e) : undefined)); + } else { + obj.coins = []; + } + return obj; + }, + fromPartial(object: DeepPartial): Output { const message = { ...baseOutput } as Output; message.coins = []; @@ -362,17 +383,6 @@ export const Output = { } return message; }, - - toJSON(message: Output): unknown { - const obj: any = {}; - message.address !== undefined && (obj.address = message.address); - if (message.coins) { - obj.coins = message.coins.map((e) => (e ? Coin.toJSON(e) : undefined)); - } else { - obj.coins = []; - } - return obj; - }, }; const baseSupply: object = {}; @@ -388,7 +398,7 @@ export const Supply = { decode(input: _m0.Reader | Uint8Array, length?: number): Supply { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseSupply) as Supply; + const message = { ...baseSupply } as Supply; message.total = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -405,22 +415,11 @@ export const Supply = { }, fromJSON(object: any): Supply { - const message = Object.create(baseSupply) as Supply; - message.total = []; - if (object.total !== undefined && object.total !== null) { - for (const e of object.total) { - message.total.push(Coin.fromJSON(e)); - } - } - return message; - }, - - fromPartial(object: DeepPartial): Supply { const message = { ...baseSupply } as Supply; message.total = []; if (object.total !== undefined && object.total !== null) { for (const e of object.total) { - message.total.push(Coin.fromPartial(e)); + message.total.push(Coin.fromJSON(e)); } } return message; @@ -435,14 +434,29 @@ export const Supply = { } return obj; }, + + fromPartial(object: DeepPartial): Supply { + const message = { ...baseSupply } as Supply; + message.total = []; + if (object.total !== undefined && object.total !== null) { + for (const e of object.total) { + message.total.push(Coin.fromPartial(e)); + } + } + return message; + }, }; const baseDenomUnit: object = { denom: "", exponent: 0, aliases: "" }; export const DenomUnit = { encode(message: DenomUnit, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.denom); - writer.uint32(16).uint32(message.exponent); + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.exponent !== 0) { + writer.uint32(16).uint32(message.exponent); + } for (const v of message.aliases) { writer.uint32(26).string(v!); } @@ -452,7 +466,7 @@ export const DenomUnit = { decode(input: _m0.Reader | Uint8Array, length?: number): DenomUnit { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseDenomUnit) as DenomUnit; + const message = { ...baseDenomUnit } as DenomUnit; message.aliases = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -475,7 +489,7 @@ export const DenomUnit = { }, fromJSON(object: any): DenomUnit { - const message = Object.create(baseDenomUnit) as DenomUnit; + const message = { ...baseDenomUnit } as DenomUnit; message.aliases = []; if (object.denom !== undefined && object.denom !== null) { message.denom = String(object.denom); @@ -495,6 +509,18 @@ export const DenomUnit = { return message; }, + toJSON(message: DenomUnit): unknown { + const obj: any = {}; + message.denom !== undefined && (obj.denom = message.denom); + message.exponent !== undefined && (obj.exponent = message.exponent); + if (message.aliases) { + obj.aliases = message.aliases.map((e) => e); + } else { + obj.aliases = []; + } + return obj; + }, + fromPartial(object: DeepPartial): DenomUnit { const message = { ...baseDenomUnit } as DenomUnit; message.aliases = []; @@ -515,37 +541,31 @@ export const DenomUnit = { } return message; }, - - toJSON(message: DenomUnit): unknown { - const obj: any = {}; - message.denom !== undefined && (obj.denom = message.denom); - message.exponent !== undefined && (obj.exponent = message.exponent); - if (message.aliases) { - obj.aliases = message.aliases.map((e) => e); - } else { - obj.aliases = []; - } - return obj; - }, }; const baseMetadata: object = { description: "", base: "", display: "" }; export const Metadata = { encode(message: Metadata, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.description); + if (message.description !== "") { + writer.uint32(10).string(message.description); + } for (const v of message.denomUnits) { DenomUnit.encode(v!, writer.uint32(18).fork()).ldelim(); } - writer.uint32(26).string(message.base); - writer.uint32(34).string(message.display); + if (message.base !== "") { + writer.uint32(26).string(message.base); + } + if (message.display !== "") { + writer.uint32(34).string(message.display); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): Metadata { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseMetadata) as Metadata; + const message = { ...baseMetadata } as Metadata; message.denomUnits = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -571,7 +591,7 @@ export const Metadata = { }, fromJSON(object: any): Metadata { - const message = Object.create(baseMetadata) as Metadata; + const message = { ...baseMetadata } as Metadata; message.denomUnits = []; if (object.description !== undefined && object.description !== null) { message.description = String(object.description); @@ -596,6 +616,19 @@ export const Metadata = { return message; }, + toJSON(message: Metadata): unknown { + const obj: any = {}; + message.description !== undefined && (obj.description = message.description); + if (message.denomUnits) { + obj.denomUnits = message.denomUnits.map((e) => (e ? DenomUnit.toJSON(e) : undefined)); + } else { + obj.denomUnits = []; + } + message.base !== undefined && (obj.base = message.base); + message.display !== undefined && (obj.display = message.display); + return obj; + }, + fromPartial(object: DeepPartial): Metadata { const message = { ...baseMetadata } as Metadata; message.denomUnits = []; @@ -621,19 +654,6 @@ export const Metadata = { } return message; }, - - toJSON(message: Metadata): unknown { - const obj: any = {}; - message.description !== undefined && (obj.description = message.description); - if (message.denomUnits) { - obj.denomUnits = message.denomUnits.map((e) => (e ? DenomUnit.toJSON(e) : undefined)); - } else { - obj.denomUnits = []; - } - message.base !== undefined && (obj.base = message.base); - message.display !== undefined && (obj.display = message.display); - return obj; - }, }; type Builtin = Date | Function | Uint8Array | string | number | undefined | Long; diff --git a/packages/proto-signing/src/codec/cosmos/bank/v1beta1/tx.ts b/packages/proto-signing/src/codec/cosmos/bank/v1beta1/tx.ts index f13c2a76..5aeee5b9 100644 --- a/packages/proto-signing/src/codec/cosmos/bank/v1beta1/tx.ts +++ b/packages/proto-signing/src/codec/cosmos/bank/v1beta1/tx.ts @@ -29,8 +29,12 @@ const baseMsgSend: object = { fromAddress: "", toAddress: "" }; export const MsgSend = { encode(message: MsgSend, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.fromAddress); - writer.uint32(18).string(message.toAddress); + if (message.fromAddress !== "") { + writer.uint32(10).string(message.fromAddress); + } + if (message.toAddress !== "") { + writer.uint32(18).string(message.toAddress); + } for (const v of message.amount) { Coin.encode(v!, writer.uint32(26).fork()).ldelim(); } @@ -40,7 +44,7 @@ export const MsgSend = { decode(input: _m0.Reader | Uint8Array, length?: number): MsgSend { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseMsgSend) as MsgSend; + const message = { ...baseMsgSend } as MsgSend; message.amount = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -63,7 +67,7 @@ export const MsgSend = { }, fromJSON(object: any): MsgSend { - const message = Object.create(baseMsgSend) as MsgSend; + const message = { ...baseMsgSend } as MsgSend; message.amount = []; if (object.fromAddress !== undefined && object.fromAddress !== null) { message.fromAddress = String(object.fromAddress); @@ -83,6 +87,18 @@ export const MsgSend = { return message; }, + toJSON(message: MsgSend): unknown { + const obj: any = {}; + message.fromAddress !== undefined && (obj.fromAddress = message.fromAddress); + message.toAddress !== undefined && (obj.toAddress = message.toAddress); + if (message.amount) { + obj.amount = message.amount.map((e) => (e ? Coin.toJSON(e) : undefined)); + } else { + obj.amount = []; + } + return obj; + }, + fromPartial(object: DeepPartial): MsgSend { const message = { ...baseMsgSend } as MsgSend; message.amount = []; @@ -103,18 +119,6 @@ export const MsgSend = { } return message; }, - - toJSON(message: MsgSend): unknown { - const obj: any = {}; - message.fromAddress !== undefined && (obj.fromAddress = message.fromAddress); - message.toAddress !== undefined && (obj.toAddress = message.toAddress); - if (message.amount) { - obj.amount = message.amount.map((e) => (e ? Coin.toJSON(e) : undefined)); - } else { - obj.amount = []; - } - return obj; - }, }; const baseMsgSendResponse: object = {}; @@ -127,7 +131,7 @@ export const MsgSendResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): MsgSendResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseMsgSendResponse) as MsgSendResponse; + const message = { ...baseMsgSendResponse } as MsgSendResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -140,11 +144,6 @@ export const MsgSendResponse = { }, fromJSON(_: any): MsgSendResponse { - const message = Object.create(baseMsgSendResponse) as MsgSendResponse; - return message; - }, - - fromPartial(_: DeepPartial): MsgSendResponse { const message = { ...baseMsgSendResponse } as MsgSendResponse; return message; }, @@ -153,6 +152,11 @@ export const MsgSendResponse = { const obj: any = {}; return obj; }, + + fromPartial(_: DeepPartial): MsgSendResponse { + const message = { ...baseMsgSendResponse } as MsgSendResponse; + return message; + }, }; const baseMsgMultiSend: object = {}; @@ -171,7 +175,7 @@ export const MsgMultiSend = { decode(input: _m0.Reader | Uint8Array, length?: number): MsgMultiSend { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseMsgMultiSend) as MsgMultiSend; + const message = { ...baseMsgMultiSend } as MsgMultiSend; message.inputs = []; message.outputs = []; while (reader.pos < end) { @@ -192,7 +196,7 @@ export const MsgMultiSend = { }, fromJSON(object: any): MsgMultiSend { - const message = Object.create(baseMsgMultiSend) as MsgMultiSend; + const message = { ...baseMsgMultiSend } as MsgMultiSend; message.inputs = []; message.outputs = []; if (object.inputs !== undefined && object.inputs !== null) { @@ -208,23 +212,6 @@ export const MsgMultiSend = { return message; }, - fromPartial(object: DeepPartial): MsgMultiSend { - const message = { ...baseMsgMultiSend } as MsgMultiSend; - message.inputs = []; - message.outputs = []; - if (object.inputs !== undefined && object.inputs !== null) { - for (const e of object.inputs) { - message.inputs.push(Input.fromPartial(e)); - } - } - if (object.outputs !== undefined && object.outputs !== null) { - for (const e of object.outputs) { - message.outputs.push(Output.fromPartial(e)); - } - } - return message; - }, - toJSON(message: MsgMultiSend): unknown { const obj: any = {}; if (message.inputs) { @@ -239,6 +226,23 @@ export const MsgMultiSend = { } return obj; }, + + fromPartial(object: DeepPartial): MsgMultiSend { + const message = { ...baseMsgMultiSend } as MsgMultiSend; + message.inputs = []; + message.outputs = []; + if (object.inputs !== undefined && object.inputs !== null) { + for (const e of object.inputs) { + message.inputs.push(Input.fromPartial(e)); + } + } + if (object.outputs !== undefined && object.outputs !== null) { + for (const e of object.outputs) { + message.outputs.push(Output.fromPartial(e)); + } + } + return message; + }, }; const baseMsgMultiSendResponse: object = {}; @@ -251,7 +255,7 @@ export const MsgMultiSendResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): MsgMultiSendResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseMsgMultiSendResponse) as MsgMultiSendResponse; + const message = { ...baseMsgMultiSendResponse } as MsgMultiSendResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -264,11 +268,6 @@ export const MsgMultiSendResponse = { }, fromJSON(_: any): MsgMultiSendResponse { - const message = Object.create(baseMsgMultiSendResponse) as MsgMultiSendResponse; - return message; - }, - - fromPartial(_: DeepPartial): MsgMultiSendResponse { const message = { ...baseMsgMultiSendResponse } as MsgMultiSendResponse; return message; }, @@ -277,6 +276,11 @@ export const MsgMultiSendResponse = { const obj: any = {}; return obj; }, + + fromPartial(_: DeepPartial): MsgMultiSendResponse { + const message = { ...baseMsgMultiSendResponse } as MsgMultiSendResponse; + return message; + }, }; /** Msg defines the bank Msg service. */ diff --git a/packages/proto-signing/src/codec/cosmos/base/v1beta1/coin.ts b/packages/proto-signing/src/codec/cosmos/base/v1beta1/coin.ts index 87506a94..e682a9a7 100644 --- a/packages/proto-signing/src/codec/cosmos/base/v1beta1/coin.ts +++ b/packages/proto-signing/src/codec/cosmos/base/v1beta1/coin.ts @@ -40,15 +40,19 @@ const baseCoin: object = { denom: "", amount: "" }; export const Coin = { encode(message: Coin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.denom); - writer.uint32(18).string(message.amount); + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): Coin { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseCoin) as Coin; + const message = { ...baseCoin } as Coin; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -67,7 +71,7 @@ export const Coin = { }, fromJSON(object: any): Coin { - const message = Object.create(baseCoin) as Coin; + const message = { ...baseCoin } as Coin; if (object.denom !== undefined && object.denom !== null) { message.denom = String(object.denom); } else { @@ -81,6 +85,13 @@ export const Coin = { return message; }, + toJSON(message: Coin): unknown { + const obj: any = {}; + message.denom !== undefined && (obj.denom = message.denom); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + fromPartial(object: DeepPartial): Coin { const message = { ...baseCoin } as Coin; if (object.denom !== undefined && object.denom !== null) { @@ -95,28 +106,25 @@ export const Coin = { } return message; }, - - toJSON(message: Coin): unknown { - const obj: any = {}; - message.denom !== undefined && (obj.denom = message.denom); - message.amount !== undefined && (obj.amount = message.amount); - return obj; - }, }; const baseDecCoin: object = { denom: "", amount: "" }; export const DecCoin = { encode(message: DecCoin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.denom); - writer.uint32(18).string(message.amount); + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): DecCoin { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseDecCoin) as DecCoin; + const message = { ...baseDecCoin } as DecCoin; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -135,7 +143,7 @@ export const DecCoin = { }, fromJSON(object: any): DecCoin { - const message = Object.create(baseDecCoin) as DecCoin; + const message = { ...baseDecCoin } as DecCoin; if (object.denom !== undefined && object.denom !== null) { message.denom = String(object.denom); } else { @@ -149,6 +157,13 @@ export const DecCoin = { return message; }, + toJSON(message: DecCoin): unknown { + const obj: any = {}; + message.denom !== undefined && (obj.denom = message.denom); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + fromPartial(object: DeepPartial): DecCoin { const message = { ...baseDecCoin } as DecCoin; if (object.denom !== undefined && object.denom !== null) { @@ -163,27 +178,22 @@ export const DecCoin = { } return message; }, - - toJSON(message: DecCoin): unknown { - const obj: any = {}; - message.denom !== undefined && (obj.denom = message.denom); - message.amount !== undefined && (obj.amount = message.amount); - return obj; - }, }; const baseIntProto: object = { int: "" }; export const IntProto = { encode(message: IntProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.int); + if (message.int !== "") { + writer.uint32(10).string(message.int); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): IntProto { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseIntProto) as IntProto; + const message = { ...baseIntProto } as IntProto; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -199,19 +209,9 @@ export const IntProto = { }, fromJSON(object: any): IntProto { - const message = Object.create(baseIntProto) as IntProto; - if (object.int !== undefined && object.int !== null) { - message.int = String(object.int); - } else { - message.int = ""; - } - return message; - }, - - fromPartial(object: DeepPartial): IntProto { const message = { ...baseIntProto } as IntProto; if (object.int !== undefined && object.int !== null) { - message.int = object.int; + message.int = String(object.int); } else { message.int = ""; } @@ -223,20 +223,32 @@ export const IntProto = { message.int !== undefined && (obj.int = message.int); return obj; }, + + fromPartial(object: DeepPartial): IntProto { + const message = { ...baseIntProto } as IntProto; + if (object.int !== undefined && object.int !== null) { + message.int = object.int; + } else { + message.int = ""; + } + return message; + }, }; const baseDecProto: object = { dec: "" }; export const DecProto = { encode(message: DecProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.dec); + if (message.dec !== "") { + writer.uint32(10).string(message.dec); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): DecProto { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseDecProto) as DecProto; + const message = { ...baseDecProto } as DecProto; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -252,19 +264,9 @@ export const DecProto = { }, fromJSON(object: any): DecProto { - const message = Object.create(baseDecProto) as DecProto; - if (object.dec !== undefined && object.dec !== null) { - message.dec = String(object.dec); - } else { - message.dec = ""; - } - return message; - }, - - fromPartial(object: DeepPartial): DecProto { const message = { ...baseDecProto } as DecProto; if (object.dec !== undefined && object.dec !== null) { - message.dec = object.dec; + message.dec = String(object.dec); } else { message.dec = ""; } @@ -276,6 +278,16 @@ export const DecProto = { message.dec !== undefined && (obj.dec = message.dec); return obj; }, + + fromPartial(object: DeepPartial): DecProto { + const message = { ...baseDecProto } as DecProto; + if (object.dec !== undefined && object.dec !== null) { + message.dec = object.dec; + } else { + message.dec = ""; + } + return message; + }, }; type Builtin = Date | Function | Uint8Array | string | number | undefined | Long; diff --git a/packages/proto-signing/src/codec/cosmos/crypto/multisig/v1beta1/multisig.ts b/packages/proto-signing/src/codec/cosmos/crypto/multisig/v1beta1/multisig.ts index 5da4f9bb..11fdaf82 100644 --- a/packages/proto-signing/src/codec/cosmos/crypto/multisig/v1beta1/multisig.ts +++ b/packages/proto-signing/src/codec/cosmos/crypto/multisig/v1beta1/multisig.ts @@ -37,7 +37,7 @@ export const MultiSignature = { decode(input: _m0.Reader | Uint8Array, length?: number): MultiSignature { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseMultiSignature) as MultiSignature; + const message = { ...baseMultiSignature } as MultiSignature; message.signatures = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -54,22 +54,11 @@ export const MultiSignature = { }, fromJSON(object: any): MultiSignature { - const message = Object.create(baseMultiSignature) as MultiSignature; - message.signatures = []; - if (object.signatures !== undefined && object.signatures !== null) { - for (const e of object.signatures) { - message.signatures.push(bytesFromBase64(e)); - } - } - return message; - }, - - fromPartial(object: DeepPartial): MultiSignature { const message = { ...baseMultiSignature } as MultiSignature; message.signatures = []; if (object.signatures !== undefined && object.signatures !== null) { for (const e of object.signatures) { - message.signatures.push(e); + message.signatures.push(bytesFromBase64(e)); } } return message; @@ -84,21 +73,36 @@ export const MultiSignature = { } return obj; }, + + fromPartial(object: DeepPartial): MultiSignature { + const message = { ...baseMultiSignature } as MultiSignature; + message.signatures = []; + if (object.signatures !== undefined && object.signatures !== null) { + for (const e of object.signatures) { + message.signatures.push(e); + } + } + return message; + }, }; const baseCompactBitArray: object = { extraBitsStored: 0 }; export const CompactBitArray = { encode(message: CompactBitArray, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).uint32(message.extraBitsStored); - writer.uint32(18).bytes(message.elems); + if (message.extraBitsStored !== 0) { + writer.uint32(8).uint32(message.extraBitsStored); + } + if (message.elems.length !== 0) { + writer.uint32(18).bytes(message.elems); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): CompactBitArray { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseCompactBitArray) as CompactBitArray; + const message = { ...baseCompactBitArray } as CompactBitArray; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -117,7 +121,7 @@ export const CompactBitArray = { }, fromJSON(object: any): CompactBitArray { - const message = Object.create(baseCompactBitArray) as CompactBitArray; + const message = { ...baseCompactBitArray } as CompactBitArray; if (object.extraBitsStored !== undefined && object.extraBitsStored !== null) { message.extraBitsStored = Number(object.extraBitsStored); } else { @@ -129,6 +133,14 @@ export const CompactBitArray = { return message; }, + toJSON(message: CompactBitArray): unknown { + const obj: any = {}; + message.extraBitsStored !== undefined && (obj.extraBitsStored = message.extraBitsStored); + message.elems !== undefined && + (obj.elems = base64FromBytes(message.elems !== undefined ? message.elems : new Uint8Array())); + return obj; + }, + fromPartial(object: DeepPartial): CompactBitArray { const message = { ...baseCompactBitArray } as CompactBitArray; if (object.extraBitsStored !== undefined && object.extraBitsStored !== null) { @@ -143,14 +155,6 @@ export const CompactBitArray = { } return message; }, - - toJSON(message: CompactBitArray): unknown { - const obj: any = {}; - message.extraBitsStored !== undefined && (obj.extraBitsStored = message.extraBitsStored); - message.elems !== undefined && - (obj.elems = base64FromBytes(message.elems !== undefined ? message.elems : new Uint8Array())); - return obj; - }, }; declare var self: any | undefined; @@ -160,7 +164,7 @@ var globalThis: any = (() => { if (typeof self !== "undefined") return self; if (typeof window !== "undefined") return window; if (typeof global !== "undefined") return global; - throw new Error("Unable to locate global object"); + throw "Unable to locate global object"; })(); const atob: (b64: string) => string = diff --git a/packages/proto-signing/src/codec/cosmos/crypto/secp256k1/keys.ts b/packages/proto-signing/src/codec/cosmos/crypto/secp256k1/keys.ts index 020ec074..984a320a 100644 --- a/packages/proto-signing/src/codec/cosmos/crypto/secp256k1/keys.ts +++ b/packages/proto-signing/src/codec/cosmos/crypto/secp256k1/keys.ts @@ -24,14 +24,16 @@ const basePubKey: object = {}; export const PubKey = { encode(message: PubKey, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).bytes(message.key); + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): PubKey { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(basePubKey) as PubKey; + const message = { ...basePubKey } as PubKey; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -47,13 +49,20 @@ export const PubKey = { }, fromJSON(object: any): PubKey { - const message = Object.create(basePubKey) as PubKey; + const message = { ...basePubKey } as PubKey; if (object.key !== undefined && object.key !== null) { message.key = bytesFromBase64(object.key); } return message; }, + toJSON(message: PubKey): unknown { + const obj: any = {}; + message.key !== undefined && + (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); + return obj; + }, + fromPartial(object: DeepPartial): PubKey { const message = { ...basePubKey } as PubKey; if (object.key !== undefined && object.key !== null) { @@ -63,27 +72,22 @@ export const PubKey = { } return message; }, - - toJSON(message: PubKey): unknown { - const obj: any = {}; - message.key !== undefined && - (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); - return obj; - }, }; const basePrivKey: object = {}; export const PrivKey = { encode(message: PrivKey, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).bytes(message.key); + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): PrivKey { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(basePrivKey) as PrivKey; + const message = { ...basePrivKey } as PrivKey; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -99,13 +103,20 @@ export const PrivKey = { }, fromJSON(object: any): PrivKey { - const message = Object.create(basePrivKey) as PrivKey; + const message = { ...basePrivKey } as PrivKey; if (object.key !== undefined && object.key !== null) { message.key = bytesFromBase64(object.key); } return message; }, + toJSON(message: PrivKey): unknown { + const obj: any = {}; + message.key !== undefined && + (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); + return obj; + }, + fromPartial(object: DeepPartial): PrivKey { const message = { ...basePrivKey } as PrivKey; if (object.key !== undefined && object.key !== null) { @@ -115,13 +126,6 @@ export const PrivKey = { } return message; }, - - toJSON(message: PrivKey): unknown { - const obj: any = {}; - message.key !== undefined && - (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); - return obj; - }, }; declare var self: any | undefined; @@ -131,7 +135,7 @@ var globalThis: any = (() => { if (typeof self !== "undefined") return self; if (typeof window !== "undefined") return window; if (typeof global !== "undefined") return global; - throw new Error("Unable to locate global object"); + throw "Unable to locate global object"; })(); const atob: (b64: string) => string = diff --git a/packages/proto-signing/src/codec/cosmos/tx/signing/v1beta1/signing.ts b/packages/proto-signing/src/codec/cosmos/tx/signing/v1beta1/signing.ts index a2fe89e7..e49a7573 100644 --- a/packages/proto-signing/src/codec/cosmos/tx/signing/v1beta1/signing.ts +++ b/packages/proto-signing/src/codec/cosmos/tx/signing/v1beta1/signing.ts @@ -129,7 +129,7 @@ export const SignatureDescriptors = { decode(input: _m0.Reader | Uint8Array, length?: number): SignatureDescriptors { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseSignatureDescriptors) as SignatureDescriptors; + const message = { ...baseSignatureDescriptors } as SignatureDescriptors; message.signatures = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -146,22 +146,11 @@ export const SignatureDescriptors = { }, fromJSON(object: any): SignatureDescriptors { - const message = Object.create(baseSignatureDescriptors) as SignatureDescriptors; - message.signatures = []; - if (object.signatures !== undefined && object.signatures !== null) { - for (const e of object.signatures) { - message.signatures.push(SignatureDescriptor.fromJSON(e)); - } - } - return message; - }, - - fromPartial(object: DeepPartial): SignatureDescriptors { const message = { ...baseSignatureDescriptors } as SignatureDescriptors; message.signatures = []; if (object.signatures !== undefined && object.signatures !== null) { for (const e of object.signatures) { - message.signatures.push(SignatureDescriptor.fromPartial(e)); + message.signatures.push(SignatureDescriptor.fromJSON(e)); } } return message; @@ -176,6 +165,17 @@ export const SignatureDescriptors = { } return obj; }, + + fromPartial(object: DeepPartial): SignatureDescriptors { + const message = { ...baseSignatureDescriptors } as SignatureDescriptors; + message.signatures = []; + if (object.signatures !== undefined && object.signatures !== null) { + for (const e of object.signatures) { + message.signatures.push(SignatureDescriptor.fromPartial(e)); + } + } + return message; + }, }; const baseSignatureDescriptor: object = { sequence: Long.UZERO }; @@ -188,14 +188,16 @@ export const SignatureDescriptor = { if (message.data !== undefined) { SignatureDescriptor_Data.encode(message.data, writer.uint32(18).fork()).ldelim(); } - writer.uint32(24).uint64(message.sequence); + if (!message.sequence.isZero()) { + writer.uint32(24).uint64(message.sequence); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): SignatureDescriptor { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseSignatureDescriptor) as SignatureDescriptor; + const message = { ...baseSignatureDescriptor } as SignatureDescriptor; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -217,7 +219,7 @@ export const SignatureDescriptor = { }, fromJSON(object: any): SignatureDescriptor { - const message = Object.create(baseSignatureDescriptor) as SignatureDescriptor; + const message = { ...baseSignatureDescriptor } as SignatureDescriptor; if (object.publicKey !== undefined && object.publicKey !== null) { message.publicKey = Any.fromJSON(object.publicKey); } else { @@ -236,6 +238,16 @@ export const SignatureDescriptor = { return message; }, + toJSON(message: SignatureDescriptor): unknown { + const obj: any = {}; + message.publicKey !== undefined && + (obj.publicKey = message.publicKey ? Any.toJSON(message.publicKey) : undefined); + message.data !== undefined && + (obj.data = message.data ? SignatureDescriptor_Data.toJSON(message.data) : undefined); + message.sequence !== undefined && (obj.sequence = (message.sequence || Long.UZERO).toString()); + return obj; + }, + fromPartial(object: DeepPartial): SignatureDescriptor { const message = { ...baseSignatureDescriptor } as SignatureDescriptor; if (object.publicKey !== undefined && object.publicKey !== null) { @@ -255,16 +267,6 @@ export const SignatureDescriptor = { } return message; }, - - toJSON(message: SignatureDescriptor): unknown { - const obj: any = {}; - message.publicKey !== undefined && - (obj.publicKey = message.publicKey ? Any.toJSON(message.publicKey) : undefined); - message.data !== undefined && - (obj.data = message.data ? SignatureDescriptor_Data.toJSON(message.data) : undefined); - message.sequence !== undefined && (obj.sequence = (message.sequence || Long.UZERO).toString()); - return obj; - }, }; const baseSignatureDescriptor_Data: object = {}; @@ -283,7 +285,7 @@ export const SignatureDescriptor_Data = { decode(input: _m0.Reader | Uint8Array, length?: number): SignatureDescriptor_Data { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseSignatureDescriptor_Data) as SignatureDescriptor_Data; + const message = { ...baseSignatureDescriptor_Data } as SignatureDescriptor_Data; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -302,7 +304,7 @@ export const SignatureDescriptor_Data = { }, fromJSON(object: any): SignatureDescriptor_Data { - const message = Object.create(baseSignatureDescriptor_Data) as SignatureDescriptor_Data; + const message = { ...baseSignatureDescriptor_Data } as SignatureDescriptor_Data; if (object.single !== undefined && object.single !== null) { message.single = SignatureDescriptor_Data_Single.fromJSON(object.single); } else { @@ -316,6 +318,15 @@ export const SignatureDescriptor_Data = { return message; }, + toJSON(message: SignatureDescriptor_Data): unknown { + const obj: any = {}; + message.single !== undefined && + (obj.single = message.single ? SignatureDescriptor_Data_Single.toJSON(message.single) : undefined); + message.multi !== undefined && + (obj.multi = message.multi ? SignatureDescriptor_Data_Multi.toJSON(message.multi) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): SignatureDescriptor_Data { const message = { ...baseSignatureDescriptor_Data } as SignatureDescriptor_Data; if (object.single !== undefined && object.single !== null) { @@ -330,30 +341,25 @@ export const SignatureDescriptor_Data = { } return message; }, - - toJSON(message: SignatureDescriptor_Data): unknown { - const obj: any = {}; - message.single !== undefined && - (obj.single = message.single ? SignatureDescriptor_Data_Single.toJSON(message.single) : undefined); - message.multi !== undefined && - (obj.multi = message.multi ? SignatureDescriptor_Data_Multi.toJSON(message.multi) : undefined); - return obj; - }, }; const baseSignatureDescriptor_Data_Single: object = { mode: 0 }; export const SignatureDescriptor_Data_Single = { encode(message: SignatureDescriptor_Data_Single, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).int32(message.mode); - writer.uint32(18).bytes(message.signature); + if (message.mode !== 0) { + writer.uint32(8).int32(message.mode); + } + if (message.signature.length !== 0) { + writer.uint32(18).bytes(message.signature); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): SignatureDescriptor_Data_Single { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseSignatureDescriptor_Data_Single) as SignatureDescriptor_Data_Single; + const message = { ...baseSignatureDescriptor_Data_Single } as SignatureDescriptor_Data_Single; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -372,7 +378,7 @@ export const SignatureDescriptor_Data_Single = { }, fromJSON(object: any): SignatureDescriptor_Data_Single { - const message = Object.create(baseSignatureDescriptor_Data_Single) as SignatureDescriptor_Data_Single; + const message = { ...baseSignatureDescriptor_Data_Single } as SignatureDescriptor_Data_Single; if (object.mode !== undefined && object.mode !== null) { message.mode = signModeFromJSON(object.mode); } else { @@ -384,6 +390,16 @@ export const SignatureDescriptor_Data_Single = { return message; }, + toJSON(message: SignatureDescriptor_Data_Single): unknown { + const obj: any = {}; + message.mode !== undefined && (obj.mode = signModeToJSON(message.mode)); + message.signature !== undefined && + (obj.signature = base64FromBytes( + message.signature !== undefined ? message.signature : new Uint8Array(), + )); + return obj; + }, + fromPartial(object: DeepPartial): SignatureDescriptor_Data_Single { const message = { ...baseSignatureDescriptor_Data_Single } as SignatureDescriptor_Data_Single; if (object.mode !== undefined && object.mode !== null) { @@ -398,16 +414,6 @@ export const SignatureDescriptor_Data_Single = { } return message; }, - - toJSON(message: SignatureDescriptor_Data_Single): unknown { - const obj: any = {}; - message.mode !== undefined && (obj.mode = signModeToJSON(message.mode)); - message.signature !== undefined && - (obj.signature = base64FromBytes( - message.signature !== undefined ? message.signature : new Uint8Array(), - )); - return obj; - }, }; const baseSignatureDescriptor_Data_Multi: object = {}; @@ -426,7 +432,7 @@ export const SignatureDescriptor_Data_Multi = { decode(input: _m0.Reader | Uint8Array, length?: number): SignatureDescriptor_Data_Multi { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseSignatureDescriptor_Data_Multi) as SignatureDescriptor_Data_Multi; + const message = { ...baseSignatureDescriptor_Data_Multi } as SignatureDescriptor_Data_Multi; message.signatures = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -446,7 +452,7 @@ export const SignatureDescriptor_Data_Multi = { }, fromJSON(object: any): SignatureDescriptor_Data_Multi { - const message = Object.create(baseSignatureDescriptor_Data_Multi) as SignatureDescriptor_Data_Multi; + const message = { ...baseSignatureDescriptor_Data_Multi } as SignatureDescriptor_Data_Multi; message.signatures = []; if (object.bitarray !== undefined && object.bitarray !== null) { message.bitarray = CompactBitArray.fromJSON(object.bitarray); @@ -461,6 +467,18 @@ export const SignatureDescriptor_Data_Multi = { return message; }, + toJSON(message: SignatureDescriptor_Data_Multi): unknown { + const obj: any = {}; + message.bitarray !== undefined && + (obj.bitarray = message.bitarray ? CompactBitArray.toJSON(message.bitarray) : undefined); + if (message.signatures) { + obj.signatures = message.signatures.map((e) => (e ? SignatureDescriptor_Data.toJSON(e) : undefined)); + } else { + obj.signatures = []; + } + return obj; + }, + fromPartial(object: DeepPartial): SignatureDescriptor_Data_Multi { const message = { ...baseSignatureDescriptor_Data_Multi } as SignatureDescriptor_Data_Multi; message.signatures = []; @@ -476,18 +494,6 @@ export const SignatureDescriptor_Data_Multi = { } return message; }, - - toJSON(message: SignatureDescriptor_Data_Multi): unknown { - const obj: any = {}; - message.bitarray !== undefined && - (obj.bitarray = message.bitarray ? CompactBitArray.toJSON(message.bitarray) : undefined); - if (message.signatures) { - obj.signatures = message.signatures.map((e) => (e ? SignatureDescriptor_Data.toJSON(e) : undefined)); - } else { - obj.signatures = []; - } - return obj; - }, }; declare var self: any | undefined; @@ -497,7 +503,7 @@ var globalThis: any = (() => { if (typeof self !== "undefined") return self; if (typeof window !== "undefined") return window; if (typeof global !== "undefined") return global; - throw new Error("Unable to locate global object"); + throw "Unable to locate global object"; })(); const atob: (b64: string) => string = diff --git a/packages/proto-signing/src/codec/cosmos/tx/v1beta1/tx.ts b/packages/proto-signing/src/codec/cosmos/tx/v1beta1/tx.ts index 2351eb8b..5b23d016 100644 --- a/packages/proto-signing/src/codec/cosmos/tx/v1beta1/tx.ts +++ b/packages/proto-signing/src/codec/cosmos/tx/v1beta1/tx.ts @@ -226,7 +226,7 @@ export const Tx = { decode(input: _m0.Reader | Uint8Array, length?: number): Tx { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseTx) as Tx; + const message = { ...baseTx } as Tx; message.signatures = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -249,7 +249,7 @@ export const Tx = { }, fromJSON(object: any): Tx { - const message = Object.create(baseTx) as Tx; + const message = { ...baseTx } as Tx; message.signatures = []; if (object.body !== undefined && object.body !== null) { message.body = TxBody.fromJSON(object.body); @@ -269,6 +269,19 @@ export const Tx = { return message; }, + toJSON(message: Tx): unknown { + const obj: any = {}; + message.body !== undefined && (obj.body = message.body ? TxBody.toJSON(message.body) : undefined); + message.authInfo !== undefined && + (obj.authInfo = message.authInfo ? AuthInfo.toJSON(message.authInfo) : undefined); + if (message.signatures) { + obj.signatures = message.signatures.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.signatures = []; + } + return obj; + }, + fromPartial(object: DeepPartial): Tx { const message = { ...baseTx } as Tx; message.signatures = []; @@ -289,27 +302,18 @@ export const Tx = { } return message; }, - - toJSON(message: Tx): unknown { - const obj: any = {}; - message.body !== undefined && (obj.body = message.body ? TxBody.toJSON(message.body) : undefined); - message.authInfo !== undefined && - (obj.authInfo = message.authInfo ? AuthInfo.toJSON(message.authInfo) : undefined); - if (message.signatures) { - obj.signatures = message.signatures.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.signatures = []; - } - return obj; - }, }; const baseTxRaw: object = {}; export const TxRaw = { encode(message: TxRaw, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).bytes(message.bodyBytes); - writer.uint32(18).bytes(message.authInfoBytes); + if (message.bodyBytes.length !== 0) { + writer.uint32(10).bytes(message.bodyBytes); + } + if (message.authInfoBytes.length !== 0) { + writer.uint32(18).bytes(message.authInfoBytes); + } for (const v of message.signatures) { writer.uint32(26).bytes(v!); } @@ -319,7 +323,7 @@ export const TxRaw = { decode(input: _m0.Reader | Uint8Array, length?: number): TxRaw { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseTxRaw) as TxRaw; + const message = { ...baseTxRaw } as TxRaw; message.signatures = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -342,7 +346,7 @@ export const TxRaw = { }, fromJSON(object: any): TxRaw { - const message = Object.create(baseTxRaw) as TxRaw; + const message = { ...baseTxRaw } as TxRaw; message.signatures = []; if (object.bodyBytes !== undefined && object.bodyBytes !== null) { message.bodyBytes = bytesFromBase64(object.bodyBytes); @@ -358,27 +362,6 @@ export const TxRaw = { return message; }, - fromPartial(object: DeepPartial): TxRaw { - const message = { ...baseTxRaw } as TxRaw; - message.signatures = []; - if (object.bodyBytes !== undefined && object.bodyBytes !== null) { - message.bodyBytes = object.bodyBytes; - } else { - message.bodyBytes = new Uint8Array(); - } - if (object.authInfoBytes !== undefined && object.authInfoBytes !== null) { - message.authInfoBytes = object.authInfoBytes; - } else { - message.authInfoBytes = new Uint8Array(); - } - if (object.signatures !== undefined && object.signatures !== null) { - for (const e of object.signatures) { - message.signatures.push(e); - } - } - return message; - }, - toJSON(message: TxRaw): unknown { const obj: any = {}; message.bodyBytes !== undefined && @@ -396,23 +379,52 @@ export const TxRaw = { } return obj; }, + + fromPartial(object: DeepPartial): TxRaw { + const message = { ...baseTxRaw } as TxRaw; + message.signatures = []; + if (object.bodyBytes !== undefined && object.bodyBytes !== null) { + message.bodyBytes = object.bodyBytes; + } else { + message.bodyBytes = new Uint8Array(); + } + if (object.authInfoBytes !== undefined && object.authInfoBytes !== null) { + message.authInfoBytes = object.authInfoBytes; + } else { + message.authInfoBytes = new Uint8Array(); + } + if (object.signatures !== undefined && object.signatures !== null) { + for (const e of object.signatures) { + message.signatures.push(e); + } + } + return message; + }, }; const baseSignDoc: object = { chainId: "", accountNumber: Long.UZERO }; export const SignDoc = { encode(message: SignDoc, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).bytes(message.bodyBytes); - writer.uint32(18).bytes(message.authInfoBytes); - writer.uint32(26).string(message.chainId); - writer.uint32(32).uint64(message.accountNumber); + if (message.bodyBytes.length !== 0) { + writer.uint32(10).bytes(message.bodyBytes); + } + if (message.authInfoBytes.length !== 0) { + writer.uint32(18).bytes(message.authInfoBytes); + } + if (message.chainId !== "") { + writer.uint32(26).string(message.chainId); + } + if (!message.accountNumber.isZero()) { + writer.uint32(32).uint64(message.accountNumber); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): SignDoc { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseSignDoc) as SignDoc; + const message = { ...baseSignDoc } as SignDoc; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -437,7 +449,7 @@ export const SignDoc = { }, fromJSON(object: any): SignDoc { - const message = Object.create(baseSignDoc) as SignDoc; + const message = { ...baseSignDoc } as SignDoc; if (object.bodyBytes !== undefined && object.bodyBytes !== null) { message.bodyBytes = bytesFromBase64(object.bodyBytes); } @@ -457,6 +469,22 @@ export const SignDoc = { return message; }, + toJSON(message: SignDoc): unknown { + const obj: any = {}; + message.bodyBytes !== undefined && + (obj.bodyBytes = base64FromBytes( + message.bodyBytes !== undefined ? message.bodyBytes : new Uint8Array(), + )); + message.authInfoBytes !== undefined && + (obj.authInfoBytes = base64FromBytes( + message.authInfoBytes !== undefined ? message.authInfoBytes : new Uint8Array(), + )); + message.chainId !== undefined && (obj.chainId = message.chainId); + message.accountNumber !== undefined && + (obj.accountNumber = (message.accountNumber || Long.UZERO).toString()); + return obj; + }, + fromPartial(object: DeepPartial): SignDoc { const message = { ...baseSignDoc } as SignDoc; if (object.bodyBytes !== undefined && object.bodyBytes !== null) { @@ -481,22 +509,6 @@ export const SignDoc = { } return message; }, - - toJSON(message: SignDoc): unknown { - const obj: any = {}; - message.bodyBytes !== undefined && - (obj.bodyBytes = base64FromBytes( - message.bodyBytes !== undefined ? message.bodyBytes : new Uint8Array(), - )); - message.authInfoBytes !== undefined && - (obj.authInfoBytes = base64FromBytes( - message.authInfoBytes !== undefined ? message.authInfoBytes : new Uint8Array(), - )); - message.chainId !== undefined && (obj.chainId = message.chainId); - message.accountNumber !== undefined && - (obj.accountNumber = (message.accountNumber || Long.UZERO).toString()); - return obj; - }, }; const baseTxBody: object = { memo: "", timeoutHeight: Long.UZERO }; @@ -506,8 +518,12 @@ export const TxBody = { for (const v of message.messages) { Any.encode(v!, writer.uint32(10).fork()).ldelim(); } - writer.uint32(18).string(message.memo); - writer.uint32(24).uint64(message.timeoutHeight); + if (message.memo !== "") { + writer.uint32(18).string(message.memo); + } + if (!message.timeoutHeight.isZero()) { + writer.uint32(24).uint64(message.timeoutHeight); + } for (const v of message.extensionOptions) { Any.encode(v!, writer.uint32(8186).fork()).ldelim(); } @@ -520,7 +536,7 @@ export const TxBody = { decode(input: _m0.Reader | Uint8Array, length?: number): TxBody { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseTxBody) as TxBody; + const message = { ...baseTxBody } as TxBody; message.messages = []; message.extensionOptions = []; message.nonCriticalExtensionOptions = []; @@ -551,7 +567,7 @@ export const TxBody = { }, fromJSON(object: any): TxBody { - const message = Object.create(baseTxBody) as TxBody; + const message = { ...baseTxBody } as TxBody; message.messages = []; message.extensionOptions = []; message.nonCriticalExtensionOptions = []; @@ -583,6 +599,31 @@ export const TxBody = { return message; }, + toJSON(message: TxBody): unknown { + const obj: any = {}; + if (message.messages) { + obj.messages = message.messages.map((e) => (e ? Any.toJSON(e) : undefined)); + } else { + obj.messages = []; + } + message.memo !== undefined && (obj.memo = message.memo); + message.timeoutHeight !== undefined && + (obj.timeoutHeight = (message.timeoutHeight || Long.UZERO).toString()); + if (message.extensionOptions) { + obj.extensionOptions = message.extensionOptions.map((e) => (e ? Any.toJSON(e) : undefined)); + } else { + obj.extensionOptions = []; + } + if (message.nonCriticalExtensionOptions) { + obj.nonCriticalExtensionOptions = message.nonCriticalExtensionOptions.map((e) => + e ? Any.toJSON(e) : undefined, + ); + } else { + obj.nonCriticalExtensionOptions = []; + } + return obj; + }, + fromPartial(object: DeepPartial): TxBody { const message = { ...baseTxBody } as TxBody; message.messages = []; @@ -615,31 +656,6 @@ export const TxBody = { } return message; }, - - toJSON(message: TxBody): unknown { - const obj: any = {}; - if (message.messages) { - obj.messages = message.messages.map((e) => (e ? Any.toJSON(e) : undefined)); - } else { - obj.messages = []; - } - message.memo !== undefined && (obj.memo = message.memo); - message.timeoutHeight !== undefined && - (obj.timeoutHeight = (message.timeoutHeight || Long.UZERO).toString()); - if (message.extensionOptions) { - obj.extensionOptions = message.extensionOptions.map((e) => (e ? Any.toJSON(e) : undefined)); - } else { - obj.extensionOptions = []; - } - if (message.nonCriticalExtensionOptions) { - obj.nonCriticalExtensionOptions = message.nonCriticalExtensionOptions.map((e) => - e ? Any.toJSON(e) : undefined, - ); - } else { - obj.nonCriticalExtensionOptions = []; - } - return obj; - }, }; const baseAuthInfo: object = {}; @@ -658,7 +674,7 @@ export const AuthInfo = { decode(input: _m0.Reader | Uint8Array, length?: number): AuthInfo { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseAuthInfo) as AuthInfo; + const message = { ...baseAuthInfo } as AuthInfo; message.signerInfos = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -678,7 +694,7 @@ export const AuthInfo = { }, fromJSON(object: any): AuthInfo { - const message = Object.create(baseAuthInfo) as AuthInfo; + const message = { ...baseAuthInfo } as AuthInfo; message.signerInfos = []; if (object.signerInfos !== undefined && object.signerInfos !== null) { for (const e of object.signerInfos) { @@ -693,6 +709,17 @@ export const AuthInfo = { return message; }, + toJSON(message: AuthInfo): unknown { + const obj: any = {}; + if (message.signerInfos) { + obj.signerInfos = message.signerInfos.map((e) => (e ? SignerInfo.toJSON(e) : undefined)); + } else { + obj.signerInfos = []; + } + message.fee !== undefined && (obj.fee = message.fee ? Fee.toJSON(message.fee) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): AuthInfo { const message = { ...baseAuthInfo } as AuthInfo; message.signerInfos = []; @@ -708,17 +735,6 @@ export const AuthInfo = { } return message; }, - - toJSON(message: AuthInfo): unknown { - const obj: any = {}; - if (message.signerInfos) { - obj.signerInfos = message.signerInfos.map((e) => (e ? SignerInfo.toJSON(e) : undefined)); - } else { - obj.signerInfos = []; - } - message.fee !== undefined && (obj.fee = message.fee ? Fee.toJSON(message.fee) : undefined); - return obj; - }, }; const baseSignerInfo: object = { sequence: Long.UZERO }; @@ -731,14 +747,16 @@ export const SignerInfo = { if (message.modeInfo !== undefined) { ModeInfo.encode(message.modeInfo, writer.uint32(18).fork()).ldelim(); } - writer.uint32(24).uint64(message.sequence); + if (!message.sequence.isZero()) { + writer.uint32(24).uint64(message.sequence); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): SignerInfo { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseSignerInfo) as SignerInfo; + const message = { ...baseSignerInfo } as SignerInfo; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -760,7 +778,7 @@ export const SignerInfo = { }, fromJSON(object: any): SignerInfo { - const message = Object.create(baseSignerInfo) as SignerInfo; + const message = { ...baseSignerInfo } as SignerInfo; if (object.publicKey !== undefined && object.publicKey !== null) { message.publicKey = Any.fromJSON(object.publicKey); } else { @@ -779,6 +797,16 @@ export const SignerInfo = { return message; }, + toJSON(message: SignerInfo): unknown { + const obj: any = {}; + message.publicKey !== undefined && + (obj.publicKey = message.publicKey ? Any.toJSON(message.publicKey) : undefined); + message.modeInfo !== undefined && + (obj.modeInfo = message.modeInfo ? ModeInfo.toJSON(message.modeInfo) : undefined); + message.sequence !== undefined && (obj.sequence = (message.sequence || Long.UZERO).toString()); + return obj; + }, + fromPartial(object: DeepPartial): SignerInfo { const message = { ...baseSignerInfo } as SignerInfo; if (object.publicKey !== undefined && object.publicKey !== null) { @@ -798,16 +826,6 @@ export const SignerInfo = { } return message; }, - - toJSON(message: SignerInfo): unknown { - const obj: any = {}; - message.publicKey !== undefined && - (obj.publicKey = message.publicKey ? Any.toJSON(message.publicKey) : undefined); - message.modeInfo !== undefined && - (obj.modeInfo = message.modeInfo ? ModeInfo.toJSON(message.modeInfo) : undefined); - message.sequence !== undefined && (obj.sequence = (message.sequence || Long.UZERO).toString()); - return obj; - }, }; const baseModeInfo: object = {}; @@ -826,7 +844,7 @@ export const ModeInfo = { decode(input: _m0.Reader | Uint8Array, length?: number): ModeInfo { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseModeInfo) as ModeInfo; + const message = { ...baseModeInfo } as ModeInfo; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -845,7 +863,7 @@ export const ModeInfo = { }, fromJSON(object: any): ModeInfo { - const message = Object.create(baseModeInfo) as ModeInfo; + const message = { ...baseModeInfo } as ModeInfo; if (object.single !== undefined && object.single !== null) { message.single = ModeInfo_Single.fromJSON(object.single); } else { @@ -859,6 +877,15 @@ export const ModeInfo = { return message; }, + toJSON(message: ModeInfo): unknown { + const obj: any = {}; + message.single !== undefined && + (obj.single = message.single ? ModeInfo_Single.toJSON(message.single) : undefined); + message.multi !== undefined && + (obj.multi = message.multi ? ModeInfo_Multi.toJSON(message.multi) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): ModeInfo { const message = { ...baseModeInfo } as ModeInfo; if (object.single !== undefined && object.single !== null) { @@ -873,29 +900,22 @@ export const ModeInfo = { } return message; }, - - toJSON(message: ModeInfo): unknown { - const obj: any = {}; - message.single !== undefined && - (obj.single = message.single ? ModeInfo_Single.toJSON(message.single) : undefined); - message.multi !== undefined && - (obj.multi = message.multi ? ModeInfo_Multi.toJSON(message.multi) : undefined); - return obj; - }, }; const baseModeInfo_Single: object = { mode: 0 }; export const ModeInfo_Single = { encode(message: ModeInfo_Single, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).int32(message.mode); + if (message.mode !== 0) { + writer.uint32(8).int32(message.mode); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): ModeInfo_Single { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseModeInfo_Single) as ModeInfo_Single; + const message = { ...baseModeInfo_Single } as ModeInfo_Single; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -911,19 +931,9 @@ export const ModeInfo_Single = { }, fromJSON(object: any): ModeInfo_Single { - const message = Object.create(baseModeInfo_Single) as ModeInfo_Single; - if (object.mode !== undefined && object.mode !== null) { - message.mode = signModeFromJSON(object.mode); - } else { - message.mode = 0; - } - return message; - }, - - fromPartial(object: DeepPartial): ModeInfo_Single { const message = { ...baseModeInfo_Single } as ModeInfo_Single; if (object.mode !== undefined && object.mode !== null) { - message.mode = object.mode; + message.mode = signModeFromJSON(object.mode); } else { message.mode = 0; } @@ -935,6 +945,16 @@ export const ModeInfo_Single = { message.mode !== undefined && (obj.mode = signModeToJSON(message.mode)); return obj; }, + + fromPartial(object: DeepPartial): ModeInfo_Single { + const message = { ...baseModeInfo_Single } as ModeInfo_Single; + if (object.mode !== undefined && object.mode !== null) { + message.mode = object.mode; + } else { + message.mode = 0; + } + return message; + }, }; const baseModeInfo_Multi: object = {}; @@ -953,7 +973,7 @@ export const ModeInfo_Multi = { decode(input: _m0.Reader | Uint8Array, length?: number): ModeInfo_Multi { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseModeInfo_Multi) as ModeInfo_Multi; + const message = { ...baseModeInfo_Multi } as ModeInfo_Multi; message.modeInfos = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -973,7 +993,7 @@ export const ModeInfo_Multi = { }, fromJSON(object: any): ModeInfo_Multi { - const message = Object.create(baseModeInfo_Multi) as ModeInfo_Multi; + const message = { ...baseModeInfo_Multi } as ModeInfo_Multi; message.modeInfos = []; if (object.bitarray !== undefined && object.bitarray !== null) { message.bitarray = CompactBitArray.fromJSON(object.bitarray); @@ -988,6 +1008,18 @@ export const ModeInfo_Multi = { return message; }, + toJSON(message: ModeInfo_Multi): unknown { + const obj: any = {}; + message.bitarray !== undefined && + (obj.bitarray = message.bitarray ? CompactBitArray.toJSON(message.bitarray) : undefined); + if (message.modeInfos) { + obj.modeInfos = message.modeInfos.map((e) => (e ? ModeInfo.toJSON(e) : undefined)); + } else { + obj.modeInfos = []; + } + return obj; + }, + fromPartial(object: DeepPartial): ModeInfo_Multi { const message = { ...baseModeInfo_Multi } as ModeInfo_Multi; message.modeInfos = []; @@ -1003,18 +1035,6 @@ export const ModeInfo_Multi = { } return message; }, - - toJSON(message: ModeInfo_Multi): unknown { - const obj: any = {}; - message.bitarray !== undefined && - (obj.bitarray = message.bitarray ? CompactBitArray.toJSON(message.bitarray) : undefined); - if (message.modeInfos) { - obj.modeInfos = message.modeInfos.map((e) => (e ? ModeInfo.toJSON(e) : undefined)); - } else { - obj.modeInfos = []; - } - return obj; - }, }; const baseFee: object = { gasLimit: Long.UZERO, payer: "", granter: "" }; @@ -1024,16 +1044,22 @@ export const Fee = { for (const v of message.amount) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); } - writer.uint32(16).uint64(message.gasLimit); - writer.uint32(26).string(message.payer); - writer.uint32(34).string(message.granter); + if (!message.gasLimit.isZero()) { + writer.uint32(16).uint64(message.gasLimit); + } + if (message.payer !== "") { + writer.uint32(26).string(message.payer); + } + if (message.granter !== "") { + writer.uint32(34).string(message.granter); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): Fee { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseFee) as Fee; + const message = { ...baseFee } as Fee; message.amount = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -1059,7 +1085,7 @@ export const Fee = { }, fromJSON(object: any): Fee { - const message = Object.create(baseFee) as Fee; + const message = { ...baseFee } as Fee; message.amount = []; if (object.amount !== undefined && object.amount !== null) { for (const e of object.amount) { @@ -1084,6 +1110,19 @@ export const Fee = { return message; }, + toJSON(message: Fee): unknown { + const obj: any = {}; + if (message.amount) { + obj.amount = message.amount.map((e) => (e ? Coin.toJSON(e) : undefined)); + } else { + obj.amount = []; + } + message.gasLimit !== undefined && (obj.gasLimit = (message.gasLimit || Long.UZERO).toString()); + message.payer !== undefined && (obj.payer = message.payer); + message.granter !== undefined && (obj.granter = message.granter); + return obj; + }, + fromPartial(object: DeepPartial): Fee { const message = { ...baseFee } as Fee; message.amount = []; @@ -1109,19 +1148,6 @@ export const Fee = { } return message; }, - - toJSON(message: Fee): unknown { - const obj: any = {}; - if (message.amount) { - obj.amount = message.amount.map((e) => (e ? Coin.toJSON(e) : undefined)); - } else { - obj.amount = []; - } - message.gasLimit !== undefined && (obj.gasLimit = (message.gasLimit || Long.UZERO).toString()); - message.payer !== undefined && (obj.payer = message.payer); - message.granter !== undefined && (obj.granter = message.granter); - return obj; - }, }; declare var self: any | undefined; @@ -1131,7 +1157,7 @@ var globalThis: any = (() => { if (typeof self !== "undefined") return self; if (typeof window !== "undefined") return window; if (typeof global !== "undefined") return global; - throw new Error("Unable to locate global object"); + throw "Unable to locate global object"; })(); const atob: (b64: string) => string = diff --git a/packages/proto-signing/src/codec/google/protobuf/any.ts b/packages/proto-signing/src/codec/google/protobuf/any.ts index b7b803f5..80a855cc 100644 --- a/packages/proto-signing/src/codec/google/protobuf/any.ts +++ b/packages/proto-signing/src/codec/google/protobuf/any.ts @@ -124,15 +124,19 @@ const baseAny: object = { typeUrl: "" }; export const Any = { encode(message: Any, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.typeUrl); - writer.uint32(18).bytes(message.value); + if (message.typeUrl !== "") { + writer.uint32(10).string(message.typeUrl); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): Any { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseAny) as Any; + const message = { ...baseAny } as Any; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -151,7 +155,7 @@ export const Any = { }, fromJSON(object: any): Any { - const message = Object.create(baseAny) as Any; + const message = { ...baseAny } as Any; if (object.typeUrl !== undefined && object.typeUrl !== null) { message.typeUrl = String(object.typeUrl); } else { @@ -163,6 +167,14 @@ export const Any = { return message; }, + toJSON(message: Any): unknown { + const obj: any = {}; + message.typeUrl !== undefined && (obj.typeUrl = message.typeUrl); + message.value !== undefined && + (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); + return obj; + }, + fromPartial(object: DeepPartial): Any { const message = { ...baseAny } as Any; if (object.typeUrl !== undefined && object.typeUrl !== null) { @@ -177,14 +189,6 @@ export const Any = { } return message; }, - - toJSON(message: Any): unknown { - const obj: any = {}; - message.typeUrl !== undefined && (obj.typeUrl = message.typeUrl); - message.value !== undefined && - (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); - return obj; - }, }; declare var self: any | undefined; @@ -194,7 +198,7 @@ var globalThis: any = (() => { if (typeof self !== "undefined") return self; if (typeof window !== "undefined") return window; if (typeof global !== "undefined") return global; - throw new Error("Unable to locate global object"); + throw "Unable to locate global object"; })(); const atob: (b64: string) => string = diff --git a/packages/proto-signing/src/codec/google/protobuf/descriptor.ts b/packages/proto-signing/src/codec/google/protobuf/descriptor.ts index 856037ad..1b4f692c 100644 --- a/packages/proto-signing/src/codec/google/protobuf/descriptor.ts +++ b/packages/proto-signing/src/codec/google/protobuf/descriptor.ts @@ -1125,7 +1125,7 @@ export const FileDescriptorSet = { decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorSet { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseFileDescriptorSet) as FileDescriptorSet; + const message = { ...baseFileDescriptorSet } as FileDescriptorSet; message.file = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -1142,22 +1142,11 @@ export const FileDescriptorSet = { }, fromJSON(object: any): FileDescriptorSet { - const message = Object.create(baseFileDescriptorSet) as FileDescriptorSet; - message.file = []; - if (object.file !== undefined && object.file !== null) { - for (const e of object.file) { - message.file.push(FileDescriptorProto.fromJSON(e)); - } - } - return message; - }, - - fromPartial(object: DeepPartial): FileDescriptorSet { const message = { ...baseFileDescriptorSet } as FileDescriptorSet; message.file = []; if (object.file !== undefined && object.file !== null) { for (const e of object.file) { - message.file.push(FileDescriptorProto.fromPartial(e)); + message.file.push(FileDescriptorProto.fromJSON(e)); } } return message; @@ -1172,6 +1161,17 @@ export const FileDescriptorSet = { } return obj; }, + + fromPartial(object: DeepPartial): FileDescriptorSet { + const message = { ...baseFileDescriptorSet } as FileDescriptorSet; + message.file = []; + if (object.file !== undefined && object.file !== null) { + for (const e of object.file) { + message.file.push(FileDescriptorProto.fromPartial(e)); + } + } + return message; + }, }; const baseFileDescriptorProto: object = { @@ -1185,8 +1185,12 @@ const baseFileDescriptorProto: object = { export const FileDescriptorProto = { encode(message: FileDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.name); - writer.uint32(18).string(message.package); + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.package !== "") { + writer.uint32(18).string(message.package); + } for (const v of message.dependency) { writer.uint32(26).string(v!); } @@ -1218,14 +1222,16 @@ export const FileDescriptorProto = { if (message.sourceCodeInfo !== undefined) { SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).ldelim(); } - writer.uint32(98).string(message.syntax); + if (message.syntax !== "") { + writer.uint32(98).string(message.syntax); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorProto { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseFileDescriptorProto) as FileDescriptorProto; + const message = { ...baseFileDescriptorProto } as FileDescriptorProto; message.dependency = []; message.publicDependency = []; message.weakDependency = []; @@ -1295,7 +1301,7 @@ export const FileDescriptorProto = { }, fromJSON(object: any): FileDescriptorProto { - const message = Object.create(baseFileDescriptorProto) as FileDescriptorProto; + const message = { ...baseFileDescriptorProto } as FileDescriptorProto; message.dependency = []; message.publicDependency = []; message.weakDependency = []; @@ -1366,6 +1372,55 @@ export const FileDescriptorProto = { return message; }, + toJSON(message: FileDescriptorProto): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.package !== undefined && (obj.package = message.package); + if (message.dependency) { + obj.dependency = message.dependency.map((e) => e); + } else { + obj.dependency = []; + } + if (message.publicDependency) { + obj.publicDependency = message.publicDependency.map((e) => e); + } else { + obj.publicDependency = []; + } + if (message.weakDependency) { + obj.weakDependency = message.weakDependency.map((e) => e); + } else { + obj.weakDependency = []; + } + if (message.messageType) { + obj.messageType = message.messageType.map((e) => (e ? DescriptorProto.toJSON(e) : undefined)); + } else { + obj.messageType = []; + } + if (message.enumType) { + obj.enumType = message.enumType.map((e) => (e ? EnumDescriptorProto.toJSON(e) : undefined)); + } else { + obj.enumType = []; + } + if (message.service) { + obj.service = message.service.map((e) => (e ? ServiceDescriptorProto.toJSON(e) : undefined)); + } else { + obj.service = []; + } + if (message.extension) { + obj.extension = message.extension.map((e) => (e ? FieldDescriptorProto.toJSON(e) : undefined)); + } else { + obj.extension = []; + } + message.options !== undefined && + (obj.options = message.options ? FileOptions.toJSON(message.options) : undefined); + message.sourceCodeInfo !== undefined && + (obj.sourceCodeInfo = message.sourceCodeInfo + ? SourceCodeInfo.toJSON(message.sourceCodeInfo) + : undefined); + message.syntax !== undefined && (obj.syntax = message.syntax); + return obj; + }, + fromPartial(object: DeepPartial): FileDescriptorProto { const message = { ...baseFileDescriptorProto } as FileDescriptorProto; message.dependency = []; @@ -1437,62 +1492,15 @@ export const FileDescriptorProto = { } return message; }, - - toJSON(message: FileDescriptorProto): unknown { - const obj: any = {}; - message.name !== undefined && (obj.name = message.name); - message.package !== undefined && (obj.package = message.package); - if (message.dependency) { - obj.dependency = message.dependency.map((e) => e); - } else { - obj.dependency = []; - } - if (message.publicDependency) { - obj.publicDependency = message.publicDependency.map((e) => e); - } else { - obj.publicDependency = []; - } - if (message.weakDependency) { - obj.weakDependency = message.weakDependency.map((e) => e); - } else { - obj.weakDependency = []; - } - if (message.messageType) { - obj.messageType = message.messageType.map((e) => (e ? DescriptorProto.toJSON(e) : undefined)); - } else { - obj.messageType = []; - } - if (message.enumType) { - obj.enumType = message.enumType.map((e) => (e ? EnumDescriptorProto.toJSON(e) : undefined)); - } else { - obj.enumType = []; - } - if (message.service) { - obj.service = message.service.map((e) => (e ? ServiceDescriptorProto.toJSON(e) : undefined)); - } else { - obj.service = []; - } - if (message.extension) { - obj.extension = message.extension.map((e) => (e ? FieldDescriptorProto.toJSON(e) : undefined)); - } else { - obj.extension = []; - } - message.options !== undefined && - (obj.options = message.options ? FileOptions.toJSON(message.options) : undefined); - message.sourceCodeInfo !== undefined && - (obj.sourceCodeInfo = message.sourceCodeInfo - ? SourceCodeInfo.toJSON(message.sourceCodeInfo) - : undefined); - message.syntax !== undefined && (obj.syntax = message.syntax); - return obj; - }, }; const baseDescriptorProto: object = { name: "", reservedName: "" }; export const DescriptorProto = { encode(message: DescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.name); + if (message.name !== "") { + writer.uint32(10).string(message.name); + } for (const v of message.field) { FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); } @@ -1526,7 +1534,7 @@ export const DescriptorProto = { decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseDescriptorProto) as DescriptorProto; + const message = { ...baseDescriptorProto } as DescriptorProto; message.field = []; message.extension = []; message.nestedType = []; @@ -1577,7 +1585,7 @@ export const DescriptorProto = { }, fromJSON(object: any): DescriptorProto { - const message = Object.create(baseDescriptorProto) as DescriptorProto; + const message = { ...baseDescriptorProto } as DescriptorProto; message.field = []; message.extension = []; message.nestedType = []; @@ -1639,6 +1647,58 @@ export const DescriptorProto = { return message; }, + toJSON(message: DescriptorProto): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + if (message.field) { + obj.field = message.field.map((e) => (e ? FieldDescriptorProto.toJSON(e) : undefined)); + } else { + obj.field = []; + } + if (message.extension) { + obj.extension = message.extension.map((e) => (e ? FieldDescriptorProto.toJSON(e) : undefined)); + } else { + obj.extension = []; + } + if (message.nestedType) { + obj.nestedType = message.nestedType.map((e) => (e ? DescriptorProto.toJSON(e) : undefined)); + } else { + obj.nestedType = []; + } + if (message.enumType) { + obj.enumType = message.enumType.map((e) => (e ? EnumDescriptorProto.toJSON(e) : undefined)); + } else { + obj.enumType = []; + } + if (message.extensionRange) { + obj.extensionRange = message.extensionRange.map((e) => + e ? DescriptorProto_ExtensionRange.toJSON(e) : undefined, + ); + } else { + obj.extensionRange = []; + } + if (message.oneofDecl) { + obj.oneofDecl = message.oneofDecl.map((e) => (e ? OneofDescriptorProto.toJSON(e) : undefined)); + } else { + obj.oneofDecl = []; + } + message.options !== undefined && + (obj.options = message.options ? MessageOptions.toJSON(message.options) : undefined); + if (message.reservedRange) { + obj.reservedRange = message.reservedRange.map((e) => + e ? DescriptorProto_ReservedRange.toJSON(e) : undefined, + ); + } else { + obj.reservedRange = []; + } + if (message.reservedName) { + obj.reservedName = message.reservedName.map((e) => e); + } else { + obj.reservedName = []; + } + return obj; + }, + fromPartial(object: DeepPartial): DescriptorProto { const message = { ...baseDescriptorProto } as DescriptorProto; message.field = []; @@ -1701,66 +1761,18 @@ export const DescriptorProto = { } return message; }, - - toJSON(message: DescriptorProto): unknown { - const obj: any = {}; - message.name !== undefined && (obj.name = message.name); - if (message.field) { - obj.field = message.field.map((e) => (e ? FieldDescriptorProto.toJSON(e) : undefined)); - } else { - obj.field = []; - } - if (message.extension) { - obj.extension = message.extension.map((e) => (e ? FieldDescriptorProto.toJSON(e) : undefined)); - } else { - obj.extension = []; - } - if (message.nestedType) { - obj.nestedType = message.nestedType.map((e) => (e ? DescriptorProto.toJSON(e) : undefined)); - } else { - obj.nestedType = []; - } - if (message.enumType) { - obj.enumType = message.enumType.map((e) => (e ? EnumDescriptorProto.toJSON(e) : undefined)); - } else { - obj.enumType = []; - } - if (message.extensionRange) { - obj.extensionRange = message.extensionRange.map((e) => - e ? DescriptorProto_ExtensionRange.toJSON(e) : undefined, - ); - } else { - obj.extensionRange = []; - } - if (message.oneofDecl) { - obj.oneofDecl = message.oneofDecl.map((e) => (e ? OneofDescriptorProto.toJSON(e) : undefined)); - } else { - obj.oneofDecl = []; - } - message.options !== undefined && - (obj.options = message.options ? MessageOptions.toJSON(message.options) : undefined); - if (message.reservedRange) { - obj.reservedRange = message.reservedRange.map((e) => - e ? DescriptorProto_ReservedRange.toJSON(e) : undefined, - ); - } else { - obj.reservedRange = []; - } - if (message.reservedName) { - obj.reservedName = message.reservedName.map((e) => e); - } else { - obj.reservedName = []; - } - return obj; - }, }; const baseDescriptorProto_ExtensionRange: object = { start: 0, end: 0 }; export const DescriptorProto_ExtensionRange = { encode(message: DescriptorProto_ExtensionRange, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).int32(message.start); - writer.uint32(16).int32(message.end); + if (message.start !== 0) { + writer.uint32(8).int32(message.start); + } + if (message.end !== 0) { + writer.uint32(16).int32(message.end); + } if (message.options !== undefined) { ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); } @@ -1770,7 +1782,7 @@ export const DescriptorProto_ExtensionRange = { decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseDescriptorProto_ExtensionRange) as DescriptorProto_ExtensionRange; + const message = { ...baseDescriptorProto_ExtensionRange } as DescriptorProto_ExtensionRange; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1792,7 +1804,7 @@ export const DescriptorProto_ExtensionRange = { }, fromJSON(object: any): DescriptorProto_ExtensionRange { - const message = Object.create(baseDescriptorProto_ExtensionRange) as DescriptorProto_ExtensionRange; + const message = { ...baseDescriptorProto_ExtensionRange } as DescriptorProto_ExtensionRange; if (object.start !== undefined && object.start !== null) { message.start = Number(object.start); } else { @@ -1811,6 +1823,15 @@ export const DescriptorProto_ExtensionRange = { return message; }, + toJSON(message: DescriptorProto_ExtensionRange): unknown { + const obj: any = {}; + message.start !== undefined && (obj.start = message.start); + message.end !== undefined && (obj.end = message.end); + message.options !== undefined && + (obj.options = message.options ? ExtensionRangeOptions.toJSON(message.options) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): DescriptorProto_ExtensionRange { const message = { ...baseDescriptorProto_ExtensionRange } as DescriptorProto_ExtensionRange; if (object.start !== undefined && object.start !== null) { @@ -1830,30 +1851,25 @@ export const DescriptorProto_ExtensionRange = { } return message; }, - - toJSON(message: DescriptorProto_ExtensionRange): unknown { - const obj: any = {}; - message.start !== undefined && (obj.start = message.start); - message.end !== undefined && (obj.end = message.end); - message.options !== undefined && - (obj.options = message.options ? ExtensionRangeOptions.toJSON(message.options) : undefined); - return obj; - }, }; const baseDescriptorProto_ReservedRange: object = { start: 0, end: 0 }; export const DescriptorProto_ReservedRange = { encode(message: DescriptorProto_ReservedRange, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).int32(message.start); - writer.uint32(16).int32(message.end); + if (message.start !== 0) { + writer.uint32(8).int32(message.start); + } + if (message.end !== 0) { + writer.uint32(16).int32(message.end); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto_ReservedRange { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseDescriptorProto_ReservedRange) as DescriptorProto_ReservedRange; + const message = { ...baseDescriptorProto_ReservedRange } as DescriptorProto_ReservedRange; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1872,7 +1888,7 @@ export const DescriptorProto_ReservedRange = { }, fromJSON(object: any): DescriptorProto_ReservedRange { - const message = Object.create(baseDescriptorProto_ReservedRange) as DescriptorProto_ReservedRange; + const message = { ...baseDescriptorProto_ReservedRange } as DescriptorProto_ReservedRange; if (object.start !== undefined && object.start !== null) { message.start = Number(object.start); } else { @@ -1886,6 +1902,13 @@ export const DescriptorProto_ReservedRange = { return message; }, + toJSON(message: DescriptorProto_ReservedRange): unknown { + const obj: any = {}; + message.start !== undefined && (obj.start = message.start); + message.end !== undefined && (obj.end = message.end); + return obj; + }, + fromPartial(object: DeepPartial): DescriptorProto_ReservedRange { const message = { ...baseDescriptorProto_ReservedRange } as DescriptorProto_ReservedRange; if (object.start !== undefined && object.start !== null) { @@ -1900,13 +1923,6 @@ export const DescriptorProto_ReservedRange = { } return message; }, - - toJSON(message: DescriptorProto_ReservedRange): unknown { - const obj: any = {}; - message.start !== undefined && (obj.start = message.start); - message.end !== undefined && (obj.end = message.end); - return obj; - }, }; const baseExtensionRangeOptions: object = {}; @@ -1922,7 +1938,7 @@ export const ExtensionRangeOptions = { decode(input: _m0.Reader | Uint8Array, length?: number): ExtensionRangeOptions { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseExtensionRangeOptions) as ExtensionRangeOptions; + const message = { ...baseExtensionRangeOptions } as ExtensionRangeOptions; message.uninterpretedOption = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -1939,22 +1955,11 @@ export const ExtensionRangeOptions = { }, fromJSON(object: any): ExtensionRangeOptions { - const message = Object.create(baseExtensionRangeOptions) as ExtensionRangeOptions; - message.uninterpretedOption = []; - if (object.uninterpretedOption !== undefined && object.uninterpretedOption !== null) { - for (const e of object.uninterpretedOption) { - message.uninterpretedOption.push(UninterpretedOption.fromJSON(e)); - } - } - return message; - }, - - fromPartial(object: DeepPartial): ExtensionRangeOptions { const message = { ...baseExtensionRangeOptions } as ExtensionRangeOptions; message.uninterpretedOption = []; if (object.uninterpretedOption !== undefined && object.uninterpretedOption !== null) { for (const e of object.uninterpretedOption) { - message.uninterpretedOption.push(UninterpretedOption.fromPartial(e)); + message.uninterpretedOption.push(UninterpretedOption.fromJSON(e)); } } return message; @@ -1971,6 +1976,17 @@ export const ExtensionRangeOptions = { } return obj; }, + + fromPartial(object: DeepPartial): ExtensionRangeOptions { + const message = { ...baseExtensionRangeOptions } as ExtensionRangeOptions; + message.uninterpretedOption = []; + if (object.uninterpretedOption !== undefined && object.uninterpretedOption !== null) { + for (const e of object.uninterpretedOption) { + message.uninterpretedOption.push(UninterpretedOption.fromPartial(e)); + } + } + return message; + }, }; const baseFieldDescriptorProto: object = { @@ -1988,26 +2004,46 @@ const baseFieldDescriptorProto: object = { export const FieldDescriptorProto = { encode(message: FieldDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.name); - writer.uint32(24).int32(message.number); - writer.uint32(32).int32(message.label); - writer.uint32(40).int32(message.type); - writer.uint32(50).string(message.typeName); - writer.uint32(18).string(message.extendee); - writer.uint32(58).string(message.defaultValue); - writer.uint32(72).int32(message.oneofIndex); - writer.uint32(82).string(message.jsonName); + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== 0) { + writer.uint32(24).int32(message.number); + } + if (message.label !== 1) { + writer.uint32(32).int32(message.label); + } + if (message.type !== 1) { + writer.uint32(40).int32(message.type); + } + if (message.typeName !== "") { + writer.uint32(50).string(message.typeName); + } + if (message.extendee !== "") { + writer.uint32(18).string(message.extendee); + } + if (message.defaultValue !== "") { + writer.uint32(58).string(message.defaultValue); + } + if (message.oneofIndex !== 0) { + writer.uint32(72).int32(message.oneofIndex); + } + if (message.jsonName !== "") { + writer.uint32(82).string(message.jsonName); + } if (message.options !== undefined) { FieldOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); } - writer.uint32(136).bool(message.proto3Optional); + if (message.proto3Optional === true) { + writer.uint32(136).bool(message.proto3Optional); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): FieldDescriptorProto { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseFieldDescriptorProto) as FieldDescriptorProto; + const message = { ...baseFieldDescriptorProto } as FieldDescriptorProto; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -2053,7 +2089,7 @@ export const FieldDescriptorProto = { }, fromJSON(object: any): FieldDescriptorProto { - const message = Object.create(baseFieldDescriptorProto) as FieldDescriptorProto; + const message = { ...baseFieldDescriptorProto } as FieldDescriptorProto; if (object.name !== undefined && object.name !== null) { message.name = String(object.name); } else { @@ -2112,6 +2148,23 @@ export const FieldDescriptorProto = { return message; }, + toJSON(message: FieldDescriptorProto): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.number !== undefined && (obj.number = message.number); + message.label !== undefined && (obj.label = fieldDescriptorProto_LabelToJSON(message.label)); + message.type !== undefined && (obj.type = fieldDescriptorProto_TypeToJSON(message.type)); + message.typeName !== undefined && (obj.typeName = message.typeName); + message.extendee !== undefined && (obj.extendee = message.extendee); + message.defaultValue !== undefined && (obj.defaultValue = message.defaultValue); + message.oneofIndex !== undefined && (obj.oneofIndex = message.oneofIndex); + message.jsonName !== undefined && (obj.jsonName = message.jsonName); + message.options !== undefined && + (obj.options = message.options ? FieldOptions.toJSON(message.options) : undefined); + message.proto3Optional !== undefined && (obj.proto3Optional = message.proto3Optional); + return obj; + }, + fromPartial(object: DeepPartial): FieldDescriptorProto { const message = { ...baseFieldDescriptorProto } as FieldDescriptorProto; if (object.name !== undefined && object.name !== null) { @@ -2171,30 +2224,15 @@ export const FieldDescriptorProto = { } return message; }, - - toJSON(message: FieldDescriptorProto): unknown { - const obj: any = {}; - message.name !== undefined && (obj.name = message.name); - message.number !== undefined && (obj.number = message.number); - message.label !== undefined && (obj.label = fieldDescriptorProto_LabelToJSON(message.label)); - message.type !== undefined && (obj.type = fieldDescriptorProto_TypeToJSON(message.type)); - message.typeName !== undefined && (obj.typeName = message.typeName); - message.extendee !== undefined && (obj.extendee = message.extendee); - message.defaultValue !== undefined && (obj.defaultValue = message.defaultValue); - message.oneofIndex !== undefined && (obj.oneofIndex = message.oneofIndex); - message.jsonName !== undefined && (obj.jsonName = message.jsonName); - message.options !== undefined && - (obj.options = message.options ? FieldOptions.toJSON(message.options) : undefined); - message.proto3Optional !== undefined && (obj.proto3Optional = message.proto3Optional); - return obj; - }, }; const baseOneofDescriptorProto: object = { name: "" }; export const OneofDescriptorProto = { encode(message: OneofDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.name); + if (message.name !== "") { + writer.uint32(10).string(message.name); + } if (message.options !== undefined) { OneofOptions.encode(message.options, writer.uint32(18).fork()).ldelim(); } @@ -2204,7 +2242,7 @@ export const OneofDescriptorProto = { decode(input: _m0.Reader | Uint8Array, length?: number): OneofDescriptorProto { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseOneofDescriptorProto) as OneofDescriptorProto; + const message = { ...baseOneofDescriptorProto } as OneofDescriptorProto; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -2223,7 +2261,7 @@ export const OneofDescriptorProto = { }, fromJSON(object: any): OneofDescriptorProto { - const message = Object.create(baseOneofDescriptorProto) as OneofDescriptorProto; + const message = { ...baseOneofDescriptorProto } as OneofDescriptorProto; if (object.name !== undefined && object.name !== null) { message.name = String(object.name); } else { @@ -2237,6 +2275,14 @@ export const OneofDescriptorProto = { return message; }, + toJSON(message: OneofDescriptorProto): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.options !== undefined && + (obj.options = message.options ? OneofOptions.toJSON(message.options) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): OneofDescriptorProto { const message = { ...baseOneofDescriptorProto } as OneofDescriptorProto; if (object.name !== undefined && object.name !== null) { @@ -2251,21 +2297,15 @@ export const OneofDescriptorProto = { } return message; }, - - toJSON(message: OneofDescriptorProto): unknown { - const obj: any = {}; - message.name !== undefined && (obj.name = message.name); - message.options !== undefined && - (obj.options = message.options ? OneofOptions.toJSON(message.options) : undefined); - return obj; - }, }; const baseEnumDescriptorProto: object = { name: "", reservedName: "" }; export const EnumDescriptorProto = { encode(message: EnumDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.name); + if (message.name !== "") { + writer.uint32(10).string(message.name); + } for (const v of message.value) { EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); } @@ -2284,7 +2324,7 @@ export const EnumDescriptorProto = { decode(input: _m0.Reader | Uint8Array, length?: number): EnumDescriptorProto { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseEnumDescriptorProto) as EnumDescriptorProto; + const message = { ...baseEnumDescriptorProto } as EnumDescriptorProto; message.value = []; message.reservedRange = []; message.reservedName = []; @@ -2315,7 +2355,7 @@ export const EnumDescriptorProto = { }, fromJSON(object: any): EnumDescriptorProto { - const message = Object.create(baseEnumDescriptorProto) as EnumDescriptorProto; + const message = { ...baseEnumDescriptorProto } as EnumDescriptorProto; message.value = []; message.reservedRange = []; message.reservedName = []; @@ -2347,6 +2387,31 @@ export const EnumDescriptorProto = { return message; }, + toJSON(message: EnumDescriptorProto): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + if (message.value) { + obj.value = message.value.map((e) => (e ? EnumValueDescriptorProto.toJSON(e) : undefined)); + } else { + obj.value = []; + } + message.options !== undefined && + (obj.options = message.options ? EnumOptions.toJSON(message.options) : undefined); + if (message.reservedRange) { + obj.reservedRange = message.reservedRange.map((e) => + e ? EnumDescriptorProto_EnumReservedRange.toJSON(e) : undefined, + ); + } else { + obj.reservedRange = []; + } + if (message.reservedName) { + obj.reservedName = message.reservedName.map((e) => e); + } else { + obj.reservedName = []; + } + return obj; + }, + fromPartial(object: DeepPartial): EnumDescriptorProto { const message = { ...baseEnumDescriptorProto } as EnumDescriptorProto; message.value = []; @@ -2379,31 +2444,6 @@ export const EnumDescriptorProto = { } return message; }, - - toJSON(message: EnumDescriptorProto): unknown { - const obj: any = {}; - message.name !== undefined && (obj.name = message.name); - if (message.value) { - obj.value = message.value.map((e) => (e ? EnumValueDescriptorProto.toJSON(e) : undefined)); - } else { - obj.value = []; - } - message.options !== undefined && - (obj.options = message.options ? EnumOptions.toJSON(message.options) : undefined); - if (message.reservedRange) { - obj.reservedRange = message.reservedRange.map((e) => - e ? EnumDescriptorProto_EnumReservedRange.toJSON(e) : undefined, - ); - } else { - obj.reservedRange = []; - } - if (message.reservedName) { - obj.reservedName = message.reservedName.map((e) => e); - } else { - obj.reservedName = []; - } - return obj; - }, }; const baseEnumDescriptorProto_EnumReservedRange: object = { start: 0, end: 0 }; @@ -2413,17 +2453,19 @@ export const EnumDescriptorProto_EnumReservedRange = { message: EnumDescriptorProto_EnumReservedRange, writer: _m0.Writer = _m0.Writer.create(), ): _m0.Writer { - writer.uint32(8).int32(message.start); - writer.uint32(16).int32(message.end); + if (message.start !== 0) { + writer.uint32(8).int32(message.start); + } + if (message.end !== 0) { + writer.uint32(16).int32(message.end); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): EnumDescriptorProto_EnumReservedRange { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create( - baseEnumDescriptorProto_EnumReservedRange, - ) as EnumDescriptorProto_EnumReservedRange; + const message = { ...baseEnumDescriptorProto_EnumReservedRange } as EnumDescriptorProto_EnumReservedRange; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -2442,9 +2484,7 @@ export const EnumDescriptorProto_EnumReservedRange = { }, fromJSON(object: any): EnumDescriptorProto_EnumReservedRange { - const message = Object.create( - baseEnumDescriptorProto_EnumReservedRange, - ) as EnumDescriptorProto_EnumReservedRange; + const message = { ...baseEnumDescriptorProto_EnumReservedRange } as EnumDescriptorProto_EnumReservedRange; if (object.start !== undefined && object.start !== null) { message.start = Number(object.start); } else { @@ -2458,6 +2498,13 @@ export const EnumDescriptorProto_EnumReservedRange = { return message; }, + toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { + const obj: any = {}; + message.start !== undefined && (obj.start = message.start); + message.end !== undefined && (obj.end = message.end); + return obj; + }, + fromPartial( object: DeepPartial, ): EnumDescriptorProto_EnumReservedRange { @@ -2474,21 +2521,18 @@ export const EnumDescriptorProto_EnumReservedRange = { } return message; }, - - toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { - const obj: any = {}; - message.start !== undefined && (obj.start = message.start); - message.end !== undefined && (obj.end = message.end); - return obj; - }, }; const baseEnumValueDescriptorProto: object = { name: "", number: 0 }; export const EnumValueDescriptorProto = { encode(message: EnumValueDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.name); - writer.uint32(16).int32(message.number); + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== 0) { + writer.uint32(16).int32(message.number); + } if (message.options !== undefined) { EnumValueOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); } @@ -2498,7 +2542,7 @@ export const EnumValueDescriptorProto = { decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueDescriptorProto { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseEnumValueDescriptorProto) as EnumValueDescriptorProto; + const message = { ...baseEnumValueDescriptorProto } as EnumValueDescriptorProto; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -2520,7 +2564,7 @@ export const EnumValueDescriptorProto = { }, fromJSON(object: any): EnumValueDescriptorProto { - const message = Object.create(baseEnumValueDescriptorProto) as EnumValueDescriptorProto; + const message = { ...baseEnumValueDescriptorProto } as EnumValueDescriptorProto; if (object.name !== undefined && object.name !== null) { message.name = String(object.name); } else { @@ -2539,6 +2583,15 @@ export const EnumValueDescriptorProto = { return message; }, + toJSON(message: EnumValueDescriptorProto): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.number !== undefined && (obj.number = message.number); + message.options !== undefined && + (obj.options = message.options ? EnumValueOptions.toJSON(message.options) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): EnumValueDescriptorProto { const message = { ...baseEnumValueDescriptorProto } as EnumValueDescriptorProto; if (object.name !== undefined && object.name !== null) { @@ -2558,22 +2611,15 @@ export const EnumValueDescriptorProto = { } return message; }, - - toJSON(message: EnumValueDescriptorProto): unknown { - const obj: any = {}; - message.name !== undefined && (obj.name = message.name); - message.number !== undefined && (obj.number = message.number); - message.options !== undefined && - (obj.options = message.options ? EnumValueOptions.toJSON(message.options) : undefined); - return obj; - }, }; const baseServiceDescriptorProto: object = { name: "" }; export const ServiceDescriptorProto = { encode(message: ServiceDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.name); + if (message.name !== "") { + writer.uint32(10).string(message.name); + } for (const v of message.method) { MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); } @@ -2586,7 +2632,7 @@ export const ServiceDescriptorProto = { decode(input: _m0.Reader | Uint8Array, length?: number): ServiceDescriptorProto { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseServiceDescriptorProto) as ServiceDescriptorProto; + const message = { ...baseServiceDescriptorProto } as ServiceDescriptorProto; message.method = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -2609,7 +2655,7 @@ export const ServiceDescriptorProto = { }, fromJSON(object: any): ServiceDescriptorProto { - const message = Object.create(baseServiceDescriptorProto) as ServiceDescriptorProto; + const message = { ...baseServiceDescriptorProto } as ServiceDescriptorProto; message.method = []; if (object.name !== undefined && object.name !== null) { message.name = String(object.name); @@ -2629,6 +2675,19 @@ export const ServiceDescriptorProto = { return message; }, + toJSON(message: ServiceDescriptorProto): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + if (message.method) { + obj.method = message.method.map((e) => (e ? MethodDescriptorProto.toJSON(e) : undefined)); + } else { + obj.method = []; + } + message.options !== undefined && + (obj.options = message.options ? ServiceOptions.toJSON(message.options) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): ServiceDescriptorProto { const message = { ...baseServiceDescriptorProto } as ServiceDescriptorProto; message.method = []; @@ -2649,19 +2708,6 @@ export const ServiceDescriptorProto = { } return message; }, - - toJSON(message: ServiceDescriptorProto): unknown { - const obj: any = {}; - message.name !== undefined && (obj.name = message.name); - if (message.method) { - obj.method = message.method.map((e) => (e ? MethodDescriptorProto.toJSON(e) : undefined)); - } else { - obj.method = []; - } - message.options !== undefined && - (obj.options = message.options ? ServiceOptions.toJSON(message.options) : undefined); - return obj; - }, }; const baseMethodDescriptorProto: object = { @@ -2674,21 +2720,31 @@ const baseMethodDescriptorProto: object = { export const MethodDescriptorProto = { encode(message: MethodDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.name); - writer.uint32(18).string(message.inputType); - writer.uint32(26).string(message.outputType); + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.inputType !== "") { + writer.uint32(18).string(message.inputType); + } + if (message.outputType !== "") { + writer.uint32(26).string(message.outputType); + } if (message.options !== undefined) { MethodOptions.encode(message.options, writer.uint32(34).fork()).ldelim(); } - writer.uint32(40).bool(message.clientStreaming); - writer.uint32(48).bool(message.serverStreaming); + if (message.clientStreaming === true) { + writer.uint32(40).bool(message.clientStreaming); + } + if (message.serverStreaming === true) { + writer.uint32(48).bool(message.serverStreaming); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): MethodDescriptorProto { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseMethodDescriptorProto) as MethodDescriptorProto; + const message = { ...baseMethodDescriptorProto } as MethodDescriptorProto; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -2719,7 +2775,7 @@ export const MethodDescriptorProto = { }, fromJSON(object: any): MethodDescriptorProto { - const message = Object.create(baseMethodDescriptorProto) as MethodDescriptorProto; + const message = { ...baseMethodDescriptorProto } as MethodDescriptorProto; if (object.name !== undefined && object.name !== null) { message.name = String(object.name); } else { @@ -2753,6 +2809,18 @@ export const MethodDescriptorProto = { return message; }, + toJSON(message: MethodDescriptorProto): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.inputType !== undefined && (obj.inputType = message.inputType); + message.outputType !== undefined && (obj.outputType = message.outputType); + message.options !== undefined && + (obj.options = message.options ? MethodOptions.toJSON(message.options) : undefined); + message.clientStreaming !== undefined && (obj.clientStreaming = message.clientStreaming); + message.serverStreaming !== undefined && (obj.serverStreaming = message.serverStreaming); + return obj; + }, + fromPartial(object: DeepPartial): MethodDescriptorProto { const message = { ...baseMethodDescriptorProto } as MethodDescriptorProto; if (object.name !== undefined && object.name !== null) { @@ -2787,18 +2855,6 @@ export const MethodDescriptorProto = { } return message; }, - - toJSON(message: MethodDescriptorProto): unknown { - const obj: any = {}; - message.name !== undefined && (obj.name = message.name); - message.inputType !== undefined && (obj.inputType = message.inputType); - message.outputType !== undefined && (obj.outputType = message.outputType); - message.options !== undefined && - (obj.options = message.options ? MethodOptions.toJSON(message.options) : undefined); - message.clientStreaming !== undefined && (obj.clientStreaming = message.clientStreaming); - message.serverStreaming !== undefined && (obj.serverStreaming = message.serverStreaming); - return obj; - }, }; const baseFileOptions: object = { @@ -2826,26 +2882,66 @@ const baseFileOptions: object = { export const FileOptions = { encode(message: FileOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.javaPackage); - writer.uint32(66).string(message.javaOuterClassname); - writer.uint32(80).bool(message.javaMultipleFiles); - writer.uint32(160).bool(message.javaGenerateEqualsAndHash); - writer.uint32(216).bool(message.javaStringCheckUtf8); - writer.uint32(72).int32(message.optimizeFor); - writer.uint32(90).string(message.goPackage); - writer.uint32(128).bool(message.ccGenericServices); - writer.uint32(136).bool(message.javaGenericServices); - writer.uint32(144).bool(message.pyGenericServices); - writer.uint32(336).bool(message.phpGenericServices); - writer.uint32(184).bool(message.deprecated); - writer.uint32(248).bool(message.ccEnableArenas); - writer.uint32(290).string(message.objcClassPrefix); - writer.uint32(298).string(message.csharpNamespace); - writer.uint32(314).string(message.swiftPrefix); - writer.uint32(322).string(message.phpClassPrefix); - writer.uint32(330).string(message.phpNamespace); - writer.uint32(354).string(message.phpMetadataNamespace); - writer.uint32(362).string(message.rubyPackage); + if (message.javaPackage !== "") { + writer.uint32(10).string(message.javaPackage); + } + if (message.javaOuterClassname !== "") { + writer.uint32(66).string(message.javaOuterClassname); + } + if (message.javaMultipleFiles === true) { + writer.uint32(80).bool(message.javaMultipleFiles); + } + if (message.javaGenerateEqualsAndHash === true) { + writer.uint32(160).bool(message.javaGenerateEqualsAndHash); + } + if (message.javaStringCheckUtf8 === true) { + writer.uint32(216).bool(message.javaStringCheckUtf8); + } + if (message.optimizeFor !== 1) { + writer.uint32(72).int32(message.optimizeFor); + } + if (message.goPackage !== "") { + writer.uint32(90).string(message.goPackage); + } + if (message.ccGenericServices === true) { + writer.uint32(128).bool(message.ccGenericServices); + } + if (message.javaGenericServices === true) { + writer.uint32(136).bool(message.javaGenericServices); + } + if (message.pyGenericServices === true) { + writer.uint32(144).bool(message.pyGenericServices); + } + if (message.phpGenericServices === true) { + writer.uint32(336).bool(message.phpGenericServices); + } + if (message.deprecated === true) { + writer.uint32(184).bool(message.deprecated); + } + if (message.ccEnableArenas === true) { + writer.uint32(248).bool(message.ccEnableArenas); + } + if (message.objcClassPrefix !== "") { + writer.uint32(290).string(message.objcClassPrefix); + } + if (message.csharpNamespace !== "") { + writer.uint32(298).string(message.csharpNamespace); + } + if (message.swiftPrefix !== "") { + writer.uint32(314).string(message.swiftPrefix); + } + if (message.phpClassPrefix !== "") { + writer.uint32(322).string(message.phpClassPrefix); + } + if (message.phpNamespace !== "") { + writer.uint32(330).string(message.phpNamespace); + } + if (message.phpMetadataNamespace !== "") { + writer.uint32(354).string(message.phpMetadataNamespace); + } + if (message.rubyPackage !== "") { + writer.uint32(362).string(message.rubyPackage); + } for (const v of message.uninterpretedOption) { UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); } @@ -2855,7 +2951,7 @@ export const FileOptions = { decode(input: _m0.Reader | Uint8Array, length?: number): FileOptions { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseFileOptions) as FileOptions; + const message = { ...baseFileOptions } as FileOptions; message.uninterpretedOption = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -2932,7 +3028,7 @@ export const FileOptions = { }, fromJSON(object: any): FileOptions { - const message = Object.create(baseFileOptions) as FileOptions; + const message = { ...baseFileOptions } as FileOptions; message.uninterpretedOption = []; if (object.javaPackage !== undefined && object.javaPackage !== null) { message.javaPackage = String(object.javaPackage); @@ -3042,6 +3138,40 @@ export const FileOptions = { return message; }, + toJSON(message: FileOptions): unknown { + const obj: any = {}; + message.javaPackage !== undefined && (obj.javaPackage = message.javaPackage); + message.javaOuterClassname !== undefined && (obj.javaOuterClassname = message.javaOuterClassname); + message.javaMultipleFiles !== undefined && (obj.javaMultipleFiles = message.javaMultipleFiles); + message.javaGenerateEqualsAndHash !== undefined && + (obj.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash); + message.javaStringCheckUtf8 !== undefined && (obj.javaStringCheckUtf8 = message.javaStringCheckUtf8); + message.optimizeFor !== undefined && + (obj.optimizeFor = fileOptions_OptimizeModeToJSON(message.optimizeFor)); + message.goPackage !== undefined && (obj.goPackage = message.goPackage); + message.ccGenericServices !== undefined && (obj.ccGenericServices = message.ccGenericServices); + message.javaGenericServices !== undefined && (obj.javaGenericServices = message.javaGenericServices); + message.pyGenericServices !== undefined && (obj.pyGenericServices = message.pyGenericServices); + message.phpGenericServices !== undefined && (obj.phpGenericServices = message.phpGenericServices); + message.deprecated !== undefined && (obj.deprecated = message.deprecated); + message.ccEnableArenas !== undefined && (obj.ccEnableArenas = message.ccEnableArenas); + message.objcClassPrefix !== undefined && (obj.objcClassPrefix = message.objcClassPrefix); + message.csharpNamespace !== undefined && (obj.csharpNamespace = message.csharpNamespace); + message.swiftPrefix !== undefined && (obj.swiftPrefix = message.swiftPrefix); + message.phpClassPrefix !== undefined && (obj.phpClassPrefix = message.phpClassPrefix); + message.phpNamespace !== undefined && (obj.phpNamespace = message.phpNamespace); + message.phpMetadataNamespace !== undefined && (obj.phpMetadataNamespace = message.phpMetadataNamespace); + message.rubyPackage !== undefined && (obj.rubyPackage = message.rubyPackage); + if (message.uninterpretedOption) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => + e ? UninterpretedOption.toJSON(e) : undefined, + ); + } else { + obj.uninterpretedOption = []; + } + return obj; + }, + fromPartial(object: DeepPartial): FileOptions { const message = { ...baseFileOptions } as FileOptions; message.uninterpretedOption = []; @@ -3152,40 +3282,6 @@ export const FileOptions = { } return message; }, - - toJSON(message: FileOptions): unknown { - const obj: any = {}; - message.javaPackage !== undefined && (obj.javaPackage = message.javaPackage); - message.javaOuterClassname !== undefined && (obj.javaOuterClassname = message.javaOuterClassname); - message.javaMultipleFiles !== undefined && (obj.javaMultipleFiles = message.javaMultipleFiles); - message.javaGenerateEqualsAndHash !== undefined && - (obj.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash); - message.javaStringCheckUtf8 !== undefined && (obj.javaStringCheckUtf8 = message.javaStringCheckUtf8); - message.optimizeFor !== undefined && - (obj.optimizeFor = fileOptions_OptimizeModeToJSON(message.optimizeFor)); - message.goPackage !== undefined && (obj.goPackage = message.goPackage); - message.ccGenericServices !== undefined && (obj.ccGenericServices = message.ccGenericServices); - message.javaGenericServices !== undefined && (obj.javaGenericServices = message.javaGenericServices); - message.pyGenericServices !== undefined && (obj.pyGenericServices = message.pyGenericServices); - message.phpGenericServices !== undefined && (obj.phpGenericServices = message.phpGenericServices); - message.deprecated !== undefined && (obj.deprecated = message.deprecated); - message.ccEnableArenas !== undefined && (obj.ccEnableArenas = message.ccEnableArenas); - message.objcClassPrefix !== undefined && (obj.objcClassPrefix = message.objcClassPrefix); - message.csharpNamespace !== undefined && (obj.csharpNamespace = message.csharpNamespace); - message.swiftPrefix !== undefined && (obj.swiftPrefix = message.swiftPrefix); - message.phpClassPrefix !== undefined && (obj.phpClassPrefix = message.phpClassPrefix); - message.phpNamespace !== undefined && (obj.phpNamespace = message.phpNamespace); - message.phpMetadataNamespace !== undefined && (obj.phpMetadataNamespace = message.phpMetadataNamespace); - message.rubyPackage !== undefined && (obj.rubyPackage = message.rubyPackage); - if (message.uninterpretedOption) { - obj.uninterpretedOption = message.uninterpretedOption.map((e) => - e ? UninterpretedOption.toJSON(e) : undefined, - ); - } else { - obj.uninterpretedOption = []; - } - return obj; - }, }; const baseMessageOptions: object = { @@ -3197,10 +3293,18 @@ const baseMessageOptions: object = { export const MessageOptions = { encode(message: MessageOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).bool(message.messageSetWireFormat); - writer.uint32(16).bool(message.noStandardDescriptorAccessor); - writer.uint32(24).bool(message.deprecated); - writer.uint32(56).bool(message.mapEntry); + if (message.messageSetWireFormat === true) { + writer.uint32(8).bool(message.messageSetWireFormat); + } + if (message.noStandardDescriptorAccessor === true) { + writer.uint32(16).bool(message.noStandardDescriptorAccessor); + } + if (message.deprecated === true) { + writer.uint32(24).bool(message.deprecated); + } + if (message.mapEntry === true) { + writer.uint32(56).bool(message.mapEntry); + } for (const v of message.uninterpretedOption) { UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); } @@ -3210,7 +3314,7 @@ export const MessageOptions = { decode(input: _m0.Reader | Uint8Array, length?: number): MessageOptions { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseMessageOptions) as MessageOptions; + const message = { ...baseMessageOptions } as MessageOptions; message.uninterpretedOption = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -3239,7 +3343,7 @@ export const MessageOptions = { }, fromJSON(object: any): MessageOptions { - const message = Object.create(baseMessageOptions) as MessageOptions; + const message = { ...baseMessageOptions } as MessageOptions; message.uninterpretedOption = []; if (object.messageSetWireFormat !== undefined && object.messageSetWireFormat !== null) { message.messageSetWireFormat = Boolean(object.messageSetWireFormat); @@ -3269,6 +3373,23 @@ export const MessageOptions = { return message; }, + toJSON(message: MessageOptions): unknown { + const obj: any = {}; + message.messageSetWireFormat !== undefined && (obj.messageSetWireFormat = message.messageSetWireFormat); + message.noStandardDescriptorAccessor !== undefined && + (obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor); + message.deprecated !== undefined && (obj.deprecated = message.deprecated); + message.mapEntry !== undefined && (obj.mapEntry = message.mapEntry); + if (message.uninterpretedOption) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => + e ? UninterpretedOption.toJSON(e) : undefined, + ); + } else { + obj.uninterpretedOption = []; + } + return obj; + }, + fromPartial(object: DeepPartial): MessageOptions { const message = { ...baseMessageOptions } as MessageOptions; message.uninterpretedOption = []; @@ -3299,23 +3420,6 @@ export const MessageOptions = { } return message; }, - - toJSON(message: MessageOptions): unknown { - const obj: any = {}; - message.messageSetWireFormat !== undefined && (obj.messageSetWireFormat = message.messageSetWireFormat); - message.noStandardDescriptorAccessor !== undefined && - (obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor); - message.deprecated !== undefined && (obj.deprecated = message.deprecated); - message.mapEntry !== undefined && (obj.mapEntry = message.mapEntry); - if (message.uninterpretedOption) { - obj.uninterpretedOption = message.uninterpretedOption.map((e) => - e ? UninterpretedOption.toJSON(e) : undefined, - ); - } else { - obj.uninterpretedOption = []; - } - return obj; - }, }; const baseFieldOptions: object = { @@ -3329,12 +3433,24 @@ const baseFieldOptions: object = { export const FieldOptions = { encode(message: FieldOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).int32(message.ctype); - writer.uint32(16).bool(message.packed); - writer.uint32(48).int32(message.jstype); - writer.uint32(40).bool(message.lazy); - writer.uint32(24).bool(message.deprecated); - writer.uint32(80).bool(message.weak); + if (message.ctype !== 0) { + writer.uint32(8).int32(message.ctype); + } + if (message.packed === true) { + writer.uint32(16).bool(message.packed); + } + if (message.jstype !== 0) { + writer.uint32(48).int32(message.jstype); + } + if (message.lazy === true) { + writer.uint32(40).bool(message.lazy); + } + if (message.deprecated === true) { + writer.uint32(24).bool(message.deprecated); + } + if (message.weak === true) { + writer.uint32(80).bool(message.weak); + } for (const v of message.uninterpretedOption) { UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); } @@ -3344,7 +3460,7 @@ export const FieldOptions = { decode(input: _m0.Reader | Uint8Array, length?: number): FieldOptions { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseFieldOptions) as FieldOptions; + const message = { ...baseFieldOptions } as FieldOptions; message.uninterpretedOption = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -3379,7 +3495,7 @@ export const FieldOptions = { }, fromJSON(object: any): FieldOptions { - const message = Object.create(baseFieldOptions) as FieldOptions; + const message = { ...baseFieldOptions } as FieldOptions; message.uninterpretedOption = []; if (object.ctype !== undefined && object.ctype !== null) { message.ctype = fieldOptions_CTypeFromJSON(object.ctype); @@ -3419,6 +3535,24 @@ export const FieldOptions = { return message; }, + toJSON(message: FieldOptions): unknown { + const obj: any = {}; + message.ctype !== undefined && (obj.ctype = fieldOptions_CTypeToJSON(message.ctype)); + message.packed !== undefined && (obj.packed = message.packed); + message.jstype !== undefined && (obj.jstype = fieldOptions_JSTypeToJSON(message.jstype)); + message.lazy !== undefined && (obj.lazy = message.lazy); + message.deprecated !== undefined && (obj.deprecated = message.deprecated); + message.weak !== undefined && (obj.weak = message.weak); + if (message.uninterpretedOption) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => + e ? UninterpretedOption.toJSON(e) : undefined, + ); + } else { + obj.uninterpretedOption = []; + } + return obj; + }, + fromPartial(object: DeepPartial): FieldOptions { const message = { ...baseFieldOptions } as FieldOptions; message.uninterpretedOption = []; @@ -3459,24 +3593,6 @@ export const FieldOptions = { } return message; }, - - toJSON(message: FieldOptions): unknown { - const obj: any = {}; - message.ctype !== undefined && (obj.ctype = fieldOptions_CTypeToJSON(message.ctype)); - message.packed !== undefined && (obj.packed = message.packed); - message.jstype !== undefined && (obj.jstype = fieldOptions_JSTypeToJSON(message.jstype)); - message.lazy !== undefined && (obj.lazy = message.lazy); - message.deprecated !== undefined && (obj.deprecated = message.deprecated); - message.weak !== undefined && (obj.weak = message.weak); - if (message.uninterpretedOption) { - obj.uninterpretedOption = message.uninterpretedOption.map((e) => - e ? UninterpretedOption.toJSON(e) : undefined, - ); - } else { - obj.uninterpretedOption = []; - } - return obj; - }, }; const baseOneofOptions: object = {}; @@ -3492,7 +3608,7 @@ export const OneofOptions = { decode(input: _m0.Reader | Uint8Array, length?: number): OneofOptions { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseOneofOptions) as OneofOptions; + const message = { ...baseOneofOptions } as OneofOptions; message.uninterpretedOption = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -3509,22 +3625,11 @@ export const OneofOptions = { }, fromJSON(object: any): OneofOptions { - const message = Object.create(baseOneofOptions) as OneofOptions; - message.uninterpretedOption = []; - if (object.uninterpretedOption !== undefined && object.uninterpretedOption !== null) { - for (const e of object.uninterpretedOption) { - message.uninterpretedOption.push(UninterpretedOption.fromJSON(e)); - } - } - return message; - }, - - fromPartial(object: DeepPartial): OneofOptions { const message = { ...baseOneofOptions } as OneofOptions; message.uninterpretedOption = []; if (object.uninterpretedOption !== undefined && object.uninterpretedOption !== null) { for (const e of object.uninterpretedOption) { - message.uninterpretedOption.push(UninterpretedOption.fromPartial(e)); + message.uninterpretedOption.push(UninterpretedOption.fromJSON(e)); } } return message; @@ -3541,14 +3646,29 @@ export const OneofOptions = { } return obj; }, + + fromPartial(object: DeepPartial): OneofOptions { + const message = { ...baseOneofOptions } as OneofOptions; + message.uninterpretedOption = []; + if (object.uninterpretedOption !== undefined && object.uninterpretedOption !== null) { + for (const e of object.uninterpretedOption) { + message.uninterpretedOption.push(UninterpretedOption.fromPartial(e)); + } + } + return message; + }, }; const baseEnumOptions: object = { allowAlias: false, deprecated: false }; export const EnumOptions = { encode(message: EnumOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(16).bool(message.allowAlias); - writer.uint32(24).bool(message.deprecated); + if (message.allowAlias === true) { + writer.uint32(16).bool(message.allowAlias); + } + if (message.deprecated === true) { + writer.uint32(24).bool(message.deprecated); + } for (const v of message.uninterpretedOption) { UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); } @@ -3558,7 +3678,7 @@ export const EnumOptions = { decode(input: _m0.Reader | Uint8Array, length?: number): EnumOptions { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseEnumOptions) as EnumOptions; + const message = { ...baseEnumOptions } as EnumOptions; message.uninterpretedOption = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -3581,7 +3701,7 @@ export const EnumOptions = { }, fromJSON(object: any): EnumOptions { - const message = Object.create(baseEnumOptions) as EnumOptions; + const message = { ...baseEnumOptions } as EnumOptions; message.uninterpretedOption = []; if (object.allowAlias !== undefined && object.allowAlias !== null) { message.allowAlias = Boolean(object.allowAlias); @@ -3601,6 +3721,20 @@ export const EnumOptions = { return message; }, + toJSON(message: EnumOptions): unknown { + const obj: any = {}; + message.allowAlias !== undefined && (obj.allowAlias = message.allowAlias); + message.deprecated !== undefined && (obj.deprecated = message.deprecated); + if (message.uninterpretedOption) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => + e ? UninterpretedOption.toJSON(e) : undefined, + ); + } else { + obj.uninterpretedOption = []; + } + return obj; + }, + fromPartial(object: DeepPartial): EnumOptions { const message = { ...baseEnumOptions } as EnumOptions; message.uninterpretedOption = []; @@ -3621,27 +3755,15 @@ export const EnumOptions = { } return message; }, - - toJSON(message: EnumOptions): unknown { - const obj: any = {}; - message.allowAlias !== undefined && (obj.allowAlias = message.allowAlias); - message.deprecated !== undefined && (obj.deprecated = message.deprecated); - if (message.uninterpretedOption) { - obj.uninterpretedOption = message.uninterpretedOption.map((e) => - e ? UninterpretedOption.toJSON(e) : undefined, - ); - } else { - obj.uninterpretedOption = []; - } - return obj; - }, }; const baseEnumValueOptions: object = { deprecated: false }; export const EnumValueOptions = { encode(message: EnumValueOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).bool(message.deprecated); + if (message.deprecated === true) { + writer.uint32(8).bool(message.deprecated); + } for (const v of message.uninterpretedOption) { UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); } @@ -3651,7 +3773,7 @@ export const EnumValueOptions = { decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueOptions { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseEnumValueOptions) as EnumValueOptions; + const message = { ...baseEnumValueOptions } as EnumValueOptions; message.uninterpretedOption = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -3671,7 +3793,7 @@ export const EnumValueOptions = { }, fromJSON(object: any): EnumValueOptions { - const message = Object.create(baseEnumValueOptions) as EnumValueOptions; + const message = { ...baseEnumValueOptions } as EnumValueOptions; message.uninterpretedOption = []; if (object.deprecated !== undefined && object.deprecated !== null) { message.deprecated = Boolean(object.deprecated); @@ -3686,22 +3808,6 @@ export const EnumValueOptions = { return message; }, - fromPartial(object: DeepPartial): EnumValueOptions { - const message = { ...baseEnumValueOptions } as EnumValueOptions; - message.uninterpretedOption = []; - if (object.deprecated !== undefined && object.deprecated !== null) { - message.deprecated = object.deprecated; - } else { - message.deprecated = false; - } - if (object.uninterpretedOption !== undefined && object.uninterpretedOption !== null) { - for (const e of object.uninterpretedOption) { - message.uninterpretedOption.push(UninterpretedOption.fromPartial(e)); - } - } - return message; - }, - toJSON(message: EnumValueOptions): unknown { const obj: any = {}; message.deprecated !== undefined && (obj.deprecated = message.deprecated); @@ -3714,13 +3820,31 @@ export const EnumValueOptions = { } return obj; }, + + fromPartial(object: DeepPartial): EnumValueOptions { + const message = { ...baseEnumValueOptions } as EnumValueOptions; + message.uninterpretedOption = []; + if (object.deprecated !== undefined && object.deprecated !== null) { + message.deprecated = object.deprecated; + } else { + message.deprecated = false; + } + if (object.uninterpretedOption !== undefined && object.uninterpretedOption !== null) { + for (const e of object.uninterpretedOption) { + message.uninterpretedOption.push(UninterpretedOption.fromPartial(e)); + } + } + return message; + }, }; const baseServiceOptions: object = { deprecated: false }; export const ServiceOptions = { encode(message: ServiceOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(264).bool(message.deprecated); + if (message.deprecated === true) { + writer.uint32(264).bool(message.deprecated); + } for (const v of message.uninterpretedOption) { UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); } @@ -3730,7 +3854,7 @@ export const ServiceOptions = { decode(input: _m0.Reader | Uint8Array, length?: number): ServiceOptions { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseServiceOptions) as ServiceOptions; + const message = { ...baseServiceOptions } as ServiceOptions; message.uninterpretedOption = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -3750,7 +3874,7 @@ export const ServiceOptions = { }, fromJSON(object: any): ServiceOptions { - const message = Object.create(baseServiceOptions) as ServiceOptions; + const message = { ...baseServiceOptions } as ServiceOptions; message.uninterpretedOption = []; if (object.deprecated !== undefined && object.deprecated !== null) { message.deprecated = Boolean(object.deprecated); @@ -3765,22 +3889,6 @@ export const ServiceOptions = { return message; }, - fromPartial(object: DeepPartial): ServiceOptions { - const message = { ...baseServiceOptions } as ServiceOptions; - message.uninterpretedOption = []; - if (object.deprecated !== undefined && object.deprecated !== null) { - message.deprecated = object.deprecated; - } else { - message.deprecated = false; - } - if (object.uninterpretedOption !== undefined && object.uninterpretedOption !== null) { - for (const e of object.uninterpretedOption) { - message.uninterpretedOption.push(UninterpretedOption.fromPartial(e)); - } - } - return message; - }, - toJSON(message: ServiceOptions): unknown { const obj: any = {}; message.deprecated !== undefined && (obj.deprecated = message.deprecated); @@ -3793,14 +3901,34 @@ export const ServiceOptions = { } return obj; }, + + fromPartial(object: DeepPartial): ServiceOptions { + const message = { ...baseServiceOptions } as ServiceOptions; + message.uninterpretedOption = []; + if (object.deprecated !== undefined && object.deprecated !== null) { + message.deprecated = object.deprecated; + } else { + message.deprecated = false; + } + if (object.uninterpretedOption !== undefined && object.uninterpretedOption !== null) { + for (const e of object.uninterpretedOption) { + message.uninterpretedOption.push(UninterpretedOption.fromPartial(e)); + } + } + return message; + }, }; const baseMethodOptions: object = { deprecated: false, idempotencyLevel: 0 }; export const MethodOptions = { encode(message: MethodOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(264).bool(message.deprecated); - writer.uint32(272).int32(message.idempotencyLevel); + if (message.deprecated === true) { + writer.uint32(264).bool(message.deprecated); + } + if (message.idempotencyLevel !== 0) { + writer.uint32(272).int32(message.idempotencyLevel); + } for (const v of message.uninterpretedOption) { UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); } @@ -3810,7 +3938,7 @@ export const MethodOptions = { decode(input: _m0.Reader | Uint8Array, length?: number): MethodOptions { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseMethodOptions) as MethodOptions; + const message = { ...baseMethodOptions } as MethodOptions; message.uninterpretedOption = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -3833,7 +3961,7 @@ export const MethodOptions = { }, fromJSON(object: any): MethodOptions { - const message = Object.create(baseMethodOptions) as MethodOptions; + const message = { ...baseMethodOptions } as MethodOptions; message.uninterpretedOption = []; if (object.deprecated !== undefined && object.deprecated !== null) { message.deprecated = Boolean(object.deprecated); @@ -3853,6 +3981,21 @@ export const MethodOptions = { return message; }, + toJSON(message: MethodOptions): unknown { + const obj: any = {}; + message.deprecated !== undefined && (obj.deprecated = message.deprecated); + message.idempotencyLevel !== undefined && + (obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel)); + if (message.uninterpretedOption) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => + e ? UninterpretedOption.toJSON(e) : undefined, + ); + } else { + obj.uninterpretedOption = []; + } + return obj; + }, + fromPartial(object: DeepPartial): MethodOptions { const message = { ...baseMethodOptions } as MethodOptions; message.uninterpretedOption = []; @@ -3873,21 +4016,6 @@ export const MethodOptions = { } return message; }, - - toJSON(message: MethodOptions): unknown { - const obj: any = {}; - message.deprecated !== undefined && (obj.deprecated = message.deprecated); - message.idempotencyLevel !== undefined && - (obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel)); - if (message.uninterpretedOption) { - obj.uninterpretedOption = message.uninterpretedOption.map((e) => - e ? UninterpretedOption.toJSON(e) : undefined, - ); - } else { - obj.uninterpretedOption = []; - } - return obj; - }, }; const baseUninterpretedOption: object = { @@ -3903,19 +4031,31 @@ export const UninterpretedOption = { for (const v of message.name) { UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).ldelim(); } - writer.uint32(26).string(message.identifierValue); - writer.uint32(32).uint64(message.positiveIntValue); - writer.uint32(40).int64(message.negativeIntValue); - writer.uint32(49).double(message.doubleValue); - writer.uint32(58).bytes(message.stringValue); - writer.uint32(66).string(message.aggregateValue); + if (message.identifierValue !== "") { + writer.uint32(26).string(message.identifierValue); + } + if (!message.positiveIntValue.isZero()) { + writer.uint32(32).uint64(message.positiveIntValue); + } + if (!message.negativeIntValue.isZero()) { + writer.uint32(40).int64(message.negativeIntValue); + } + if (message.doubleValue !== 0) { + writer.uint32(49).double(message.doubleValue); + } + if (message.stringValue.length !== 0) { + writer.uint32(58).bytes(message.stringValue); + } + if (message.aggregateValue !== "") { + writer.uint32(66).string(message.aggregateValue); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseUninterpretedOption) as UninterpretedOption; + const message = { ...baseUninterpretedOption } as UninterpretedOption; message.name = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -3950,7 +4090,7 @@ export const UninterpretedOption = { }, fromJSON(object: any): UninterpretedOption { - const message = Object.create(baseUninterpretedOption) as UninterpretedOption; + const message = { ...baseUninterpretedOption } as UninterpretedOption; message.name = []; if (object.name !== undefined && object.name !== null) { for (const e of object.name) { @@ -3988,6 +4128,27 @@ export const UninterpretedOption = { return message; }, + toJSON(message: UninterpretedOption): unknown { + const obj: any = {}; + if (message.name) { + obj.name = message.name.map((e) => (e ? UninterpretedOption_NamePart.toJSON(e) : undefined)); + } else { + obj.name = []; + } + message.identifierValue !== undefined && (obj.identifierValue = message.identifierValue); + message.positiveIntValue !== undefined && + (obj.positiveIntValue = (message.positiveIntValue || Long.UZERO).toString()); + message.negativeIntValue !== undefined && + (obj.negativeIntValue = (message.negativeIntValue || Long.ZERO).toString()); + message.doubleValue !== undefined && (obj.doubleValue = message.doubleValue); + message.stringValue !== undefined && + (obj.stringValue = base64FromBytes( + message.stringValue !== undefined ? message.stringValue : new Uint8Array(), + )); + message.aggregateValue !== undefined && (obj.aggregateValue = message.aggregateValue); + return obj; + }, + fromPartial(object: DeepPartial): UninterpretedOption { const message = { ...baseUninterpretedOption } as UninterpretedOption; message.name = []; @@ -4028,42 +4189,25 @@ export const UninterpretedOption = { } return message; }, - - toJSON(message: UninterpretedOption): unknown { - const obj: any = {}; - if (message.name) { - obj.name = message.name.map((e) => (e ? UninterpretedOption_NamePart.toJSON(e) : undefined)); - } else { - obj.name = []; - } - message.identifierValue !== undefined && (obj.identifierValue = message.identifierValue); - message.positiveIntValue !== undefined && - (obj.positiveIntValue = (message.positiveIntValue || Long.UZERO).toString()); - message.negativeIntValue !== undefined && - (obj.negativeIntValue = (message.negativeIntValue || Long.ZERO).toString()); - message.doubleValue !== undefined && (obj.doubleValue = message.doubleValue); - message.stringValue !== undefined && - (obj.stringValue = base64FromBytes( - message.stringValue !== undefined ? message.stringValue : new Uint8Array(), - )); - message.aggregateValue !== undefined && (obj.aggregateValue = message.aggregateValue); - return obj; - }, }; const baseUninterpretedOption_NamePart: object = { namePart: "", isExtension: false }; export const UninterpretedOption_NamePart = { encode(message: UninterpretedOption_NamePart, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.namePart); - writer.uint32(16).bool(message.isExtension); + if (message.namePart !== "") { + writer.uint32(10).string(message.namePart); + } + if (message.isExtension === true) { + writer.uint32(16).bool(message.isExtension); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption_NamePart { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseUninterpretedOption_NamePart) as UninterpretedOption_NamePart; + const message = { ...baseUninterpretedOption_NamePart } as UninterpretedOption_NamePart; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -4082,7 +4226,7 @@ export const UninterpretedOption_NamePart = { }, fromJSON(object: any): UninterpretedOption_NamePart { - const message = Object.create(baseUninterpretedOption_NamePart) as UninterpretedOption_NamePart; + const message = { ...baseUninterpretedOption_NamePart } as UninterpretedOption_NamePart; if (object.namePart !== undefined && object.namePart !== null) { message.namePart = String(object.namePart); } else { @@ -4096,6 +4240,13 @@ export const UninterpretedOption_NamePart = { return message; }, + toJSON(message: UninterpretedOption_NamePart): unknown { + const obj: any = {}; + message.namePart !== undefined && (obj.namePart = message.namePart); + message.isExtension !== undefined && (obj.isExtension = message.isExtension); + return obj; + }, + fromPartial(object: DeepPartial): UninterpretedOption_NamePart { const message = { ...baseUninterpretedOption_NamePart } as UninterpretedOption_NamePart; if (object.namePart !== undefined && object.namePart !== null) { @@ -4110,13 +4261,6 @@ export const UninterpretedOption_NamePart = { } return message; }, - - toJSON(message: UninterpretedOption_NamePart): unknown { - const obj: any = {}; - message.namePart !== undefined && (obj.namePart = message.namePart); - message.isExtension !== undefined && (obj.isExtension = message.isExtension); - return obj; - }, }; const baseSourceCodeInfo: object = {}; @@ -4132,7 +4276,7 @@ export const SourceCodeInfo = { decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseSourceCodeInfo) as SourceCodeInfo; + const message = { ...baseSourceCodeInfo } as SourceCodeInfo; message.location = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -4149,22 +4293,11 @@ export const SourceCodeInfo = { }, fromJSON(object: any): SourceCodeInfo { - const message = Object.create(baseSourceCodeInfo) as SourceCodeInfo; - message.location = []; - if (object.location !== undefined && object.location !== null) { - for (const e of object.location) { - message.location.push(SourceCodeInfo_Location.fromJSON(e)); - } - } - return message; - }, - - fromPartial(object: DeepPartial): SourceCodeInfo { const message = { ...baseSourceCodeInfo } as SourceCodeInfo; message.location = []; if (object.location !== undefined && object.location !== null) { for (const e of object.location) { - message.location.push(SourceCodeInfo_Location.fromPartial(e)); + message.location.push(SourceCodeInfo_Location.fromJSON(e)); } } return message; @@ -4179,6 +4312,17 @@ export const SourceCodeInfo = { } return obj; }, + + fromPartial(object: DeepPartial): SourceCodeInfo { + const message = { ...baseSourceCodeInfo } as SourceCodeInfo; + message.location = []; + if (object.location !== undefined && object.location !== null) { + for (const e of object.location) { + message.location.push(SourceCodeInfo_Location.fromPartial(e)); + } + } + return message; + }, }; const baseSourceCodeInfo_Location: object = { @@ -4201,8 +4345,12 @@ export const SourceCodeInfo_Location = { writer.int32(v); } writer.ldelim(); - writer.uint32(26).string(message.leadingComments); - writer.uint32(34).string(message.trailingComments); + if (message.leadingComments !== "") { + writer.uint32(26).string(message.leadingComments); + } + if (message.trailingComments !== "") { + writer.uint32(34).string(message.trailingComments); + } for (const v of message.leadingDetachedComments) { writer.uint32(50).string(v!); } @@ -4212,7 +4360,7 @@ export const SourceCodeInfo_Location = { decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo_Location { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseSourceCodeInfo_Location) as SourceCodeInfo_Location; + const message = { ...baseSourceCodeInfo_Location } as SourceCodeInfo_Location; message.path = []; message.span = []; message.leadingDetachedComments = []; @@ -4257,7 +4405,7 @@ export const SourceCodeInfo_Location = { }, fromJSON(object: any): SourceCodeInfo_Location { - const message = Object.create(baseSourceCodeInfo_Location) as SourceCodeInfo_Location; + const message = { ...baseSourceCodeInfo_Location } as SourceCodeInfo_Location; message.path = []; message.span = []; message.leadingDetachedComments = []; @@ -4289,6 +4437,28 @@ export const SourceCodeInfo_Location = { return message; }, + toJSON(message: SourceCodeInfo_Location): unknown { + const obj: any = {}; + if (message.path) { + obj.path = message.path.map((e) => e); + } else { + obj.path = []; + } + if (message.span) { + obj.span = message.span.map((e) => e); + } else { + obj.span = []; + } + message.leadingComments !== undefined && (obj.leadingComments = message.leadingComments); + message.trailingComments !== undefined && (obj.trailingComments = message.trailingComments); + if (message.leadingDetachedComments) { + obj.leadingDetachedComments = message.leadingDetachedComments.map((e) => e); + } else { + obj.leadingDetachedComments = []; + } + return obj; + }, + fromPartial(object: DeepPartial): SourceCodeInfo_Location { const message = { ...baseSourceCodeInfo_Location } as SourceCodeInfo_Location; message.path = []; @@ -4321,28 +4491,6 @@ export const SourceCodeInfo_Location = { } return message; }, - - toJSON(message: SourceCodeInfo_Location): unknown { - const obj: any = {}; - if (message.path) { - obj.path = message.path.map((e) => e); - } else { - obj.path = []; - } - if (message.span) { - obj.span = message.span.map((e) => e); - } else { - obj.span = []; - } - message.leadingComments !== undefined && (obj.leadingComments = message.leadingComments); - message.trailingComments !== undefined && (obj.trailingComments = message.trailingComments); - if (message.leadingDetachedComments) { - obj.leadingDetachedComments = message.leadingDetachedComments.map((e) => e); - } else { - obj.leadingDetachedComments = []; - } - return obj; - }, }; const baseGeneratedCodeInfo: object = {}; @@ -4358,7 +4506,7 @@ export const GeneratedCodeInfo = { decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseGeneratedCodeInfo) as GeneratedCodeInfo; + const message = { ...baseGeneratedCodeInfo } as GeneratedCodeInfo; message.annotation = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -4375,22 +4523,11 @@ export const GeneratedCodeInfo = { }, fromJSON(object: any): GeneratedCodeInfo { - const message = Object.create(baseGeneratedCodeInfo) as GeneratedCodeInfo; - message.annotation = []; - if (object.annotation !== undefined && object.annotation !== null) { - for (const e of object.annotation) { - message.annotation.push(GeneratedCodeInfo_Annotation.fromJSON(e)); - } - } - return message; - }, - - fromPartial(object: DeepPartial): GeneratedCodeInfo { const message = { ...baseGeneratedCodeInfo } as GeneratedCodeInfo; message.annotation = []; if (object.annotation !== undefined && object.annotation !== null) { for (const e of object.annotation) { - message.annotation.push(GeneratedCodeInfo_Annotation.fromPartial(e)); + message.annotation.push(GeneratedCodeInfo_Annotation.fromJSON(e)); } } return message; @@ -4407,6 +4544,17 @@ export const GeneratedCodeInfo = { } return obj; }, + + fromPartial(object: DeepPartial): GeneratedCodeInfo { + const message = { ...baseGeneratedCodeInfo } as GeneratedCodeInfo; + message.annotation = []; + if (object.annotation !== undefined && object.annotation !== null) { + for (const e of object.annotation) { + message.annotation.push(GeneratedCodeInfo_Annotation.fromPartial(e)); + } + } + return message; + }, }; const baseGeneratedCodeInfo_Annotation: object = { path: 0, sourceFile: "", begin: 0, end: 0 }; @@ -4418,16 +4566,22 @@ export const GeneratedCodeInfo_Annotation = { writer.int32(v); } writer.ldelim(); - writer.uint32(18).string(message.sourceFile); - writer.uint32(24).int32(message.begin); - writer.uint32(32).int32(message.end); + if (message.sourceFile !== "") { + writer.uint32(18).string(message.sourceFile); + } + if (message.begin !== 0) { + writer.uint32(24).int32(message.begin); + } + if (message.end !== 0) { + writer.uint32(32).int32(message.end); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseGeneratedCodeInfo_Annotation) as GeneratedCodeInfo_Annotation; + const message = { ...baseGeneratedCodeInfo_Annotation } as GeneratedCodeInfo_Annotation; message.path = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -4460,7 +4614,7 @@ export const GeneratedCodeInfo_Annotation = { }, fromJSON(object: any): GeneratedCodeInfo_Annotation { - const message = Object.create(baseGeneratedCodeInfo_Annotation) as GeneratedCodeInfo_Annotation; + const message = { ...baseGeneratedCodeInfo_Annotation } as GeneratedCodeInfo_Annotation; message.path = []; if (object.path !== undefined && object.path !== null) { for (const e of object.path) { @@ -4485,6 +4639,19 @@ export const GeneratedCodeInfo_Annotation = { return message; }, + toJSON(message: GeneratedCodeInfo_Annotation): unknown { + const obj: any = {}; + if (message.path) { + obj.path = message.path.map((e) => e); + } else { + obj.path = []; + } + message.sourceFile !== undefined && (obj.sourceFile = message.sourceFile); + message.begin !== undefined && (obj.begin = message.begin); + message.end !== undefined && (obj.end = message.end); + return obj; + }, + fromPartial(object: DeepPartial): GeneratedCodeInfo_Annotation { const message = { ...baseGeneratedCodeInfo_Annotation } as GeneratedCodeInfo_Annotation; message.path = []; @@ -4510,19 +4677,6 @@ export const GeneratedCodeInfo_Annotation = { } return message; }, - - toJSON(message: GeneratedCodeInfo_Annotation): unknown { - const obj: any = {}; - if (message.path) { - obj.path = message.path.map((e) => e); - } else { - obj.path = []; - } - message.sourceFile !== undefined && (obj.sourceFile = message.sourceFile); - message.begin !== undefined && (obj.begin = message.begin); - message.end !== undefined && (obj.end = message.end); - return obj; - }, }; declare var self: any | undefined; @@ -4532,7 +4686,7 @@ var globalThis: any = (() => { if (typeof self !== "undefined") return self; if (typeof window !== "undefined") return window; if (typeof global !== "undefined") return global; - throw new Error("Unable to locate global object"); + throw "Unable to locate global object"; })(); const atob: (b64: string) => string = diff --git a/packages/proto-signing/src/codec/tendermint/crypto/keys.ts b/packages/proto-signing/src/codec/tendermint/crypto/keys.ts index bfd84961..c0c2302f 100644 --- a/packages/proto-signing/src/codec/tendermint/crypto/keys.ts +++ b/packages/proto-signing/src/codec/tendermint/crypto/keys.ts @@ -26,7 +26,7 @@ export const PublicKey = { decode(input: _m0.Reader | Uint8Array, length?: number): PublicKey { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(basePublicKey) as PublicKey; + const message = { ...basePublicKey } as PublicKey; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -45,7 +45,7 @@ export const PublicKey = { }, fromJSON(object: any): PublicKey { - const message = Object.create(basePublicKey) as PublicKey; + const message = { ...basePublicKey } as PublicKey; if (object.ed25519 !== undefined && object.ed25519 !== null) { message.ed25519 = bytesFromBase64(object.ed25519); } @@ -55,6 +55,15 @@ export const PublicKey = { return message; }, + toJSON(message: PublicKey): unknown { + const obj: any = {}; + message.ed25519 !== undefined && + (obj.ed25519 = message.ed25519 !== undefined ? base64FromBytes(message.ed25519) : undefined); + message.secp256k1 !== undefined && + (obj.secp256k1 = message.secp256k1 !== undefined ? base64FromBytes(message.secp256k1) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): PublicKey { const message = { ...basePublicKey } as PublicKey; if (object.ed25519 !== undefined && object.ed25519 !== null) { @@ -69,15 +78,6 @@ export const PublicKey = { } return message; }, - - toJSON(message: PublicKey): unknown { - const obj: any = {}; - message.ed25519 !== undefined && - (obj.ed25519 = message.ed25519 !== undefined ? base64FromBytes(message.ed25519) : undefined); - message.secp256k1 !== undefined && - (obj.secp256k1 = message.secp256k1 !== undefined ? base64FromBytes(message.secp256k1) : undefined); - return obj; - }, }; declare var self: any | undefined; @@ -87,7 +87,7 @@ var globalThis: any = (() => { if (typeof self !== "undefined") return self; if (typeof window !== "undefined") return window; if (typeof global !== "undefined") return global; - throw new Error("Unable to locate global object"); + throw "Unable to locate global object"; })(); const atob: (b64: string) => string = diff --git a/packages/stargate/src/codec/confio/proofs.ts b/packages/stargate/src/codec/confio/proofs.ts index 8f3e9797..0c1e23e3 100644 --- a/packages/stargate/src/codec/confio/proofs.ts +++ b/packages/stargate/src/codec/confio/proofs.ts @@ -342,8 +342,12 @@ const baseExistenceProof: object = {}; export const ExistenceProof = { encode(message: ExistenceProof, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).bytes(message.key); - writer.uint32(18).bytes(message.value); + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } if (message.leaf !== undefined) { LeafOp.encode(message.leaf, writer.uint32(26).fork()).ldelim(); } @@ -356,7 +360,7 @@ export const ExistenceProof = { decode(input: _m0.Reader | Uint8Array, length?: number): ExistenceProof { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseExistenceProof) as ExistenceProof; + const message = { ...baseExistenceProof } as ExistenceProof; message.path = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -382,7 +386,7 @@ export const ExistenceProof = { }, fromJSON(object: any): ExistenceProof { - const message = Object.create(baseExistenceProof) as ExistenceProof; + const message = { ...baseExistenceProof } as ExistenceProof; message.path = []; if (object.key !== undefined && object.key !== null) { message.key = bytesFromBase64(object.key); @@ -403,6 +407,21 @@ export const ExistenceProof = { return message; }, + toJSON(message: ExistenceProof): unknown { + const obj: any = {}; + message.key !== undefined && + (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); + message.value !== undefined && + (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); + message.leaf !== undefined && (obj.leaf = message.leaf ? LeafOp.toJSON(message.leaf) : undefined); + if (message.path) { + obj.path = message.path.map((e) => (e ? InnerOp.toJSON(e) : undefined)); + } else { + obj.path = []; + } + return obj; + }, + fromPartial(object: DeepPartial): ExistenceProof { const message = { ...baseExistenceProof } as ExistenceProof; message.path = []; @@ -428,28 +447,15 @@ export const ExistenceProof = { } return message; }, - - toJSON(message: ExistenceProof): unknown { - const obj: any = {}; - message.key !== undefined && - (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); - message.value !== undefined && - (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); - message.leaf !== undefined && (obj.leaf = message.leaf ? LeafOp.toJSON(message.leaf) : undefined); - if (message.path) { - obj.path = message.path.map((e) => (e ? InnerOp.toJSON(e) : undefined)); - } else { - obj.path = []; - } - return obj; - }, }; const baseNonExistenceProof: object = {}; export const NonExistenceProof = { encode(message: NonExistenceProof, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).bytes(message.key); + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } if (message.left !== undefined) { ExistenceProof.encode(message.left, writer.uint32(18).fork()).ldelim(); } @@ -462,7 +468,7 @@ export const NonExistenceProof = { decode(input: _m0.Reader | Uint8Array, length?: number): NonExistenceProof { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseNonExistenceProof) as NonExistenceProof; + const message = { ...baseNonExistenceProof } as NonExistenceProof; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -484,7 +490,7 @@ export const NonExistenceProof = { }, fromJSON(object: any): NonExistenceProof { - const message = Object.create(baseNonExistenceProof) as NonExistenceProof; + const message = { ...baseNonExistenceProof } as NonExistenceProof; if (object.key !== undefined && object.key !== null) { message.key = bytesFromBase64(object.key); } @@ -501,6 +507,16 @@ export const NonExistenceProof = { return message; }, + toJSON(message: NonExistenceProof): unknown { + const obj: any = {}; + message.key !== undefined && + (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); + message.left !== undefined && (obj.left = message.left ? ExistenceProof.toJSON(message.left) : undefined); + message.right !== undefined && + (obj.right = message.right ? ExistenceProof.toJSON(message.right) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): NonExistenceProof { const message = { ...baseNonExistenceProof } as NonExistenceProof; if (object.key !== undefined && object.key !== null) { @@ -520,16 +536,6 @@ export const NonExistenceProof = { } return message; }, - - toJSON(message: NonExistenceProof): unknown { - const obj: any = {}; - message.key !== undefined && - (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); - message.left !== undefined && (obj.left = message.left ? ExistenceProof.toJSON(message.left) : undefined); - message.right !== undefined && - (obj.right = message.right ? ExistenceProof.toJSON(message.right) : undefined); - return obj; - }, }; const baseCommitmentProof: object = {}; @@ -554,7 +560,7 @@ export const CommitmentProof = { decode(input: _m0.Reader | Uint8Array, length?: number): CommitmentProof { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseCommitmentProof) as CommitmentProof; + const message = { ...baseCommitmentProof } as CommitmentProof; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -579,7 +585,7 @@ export const CommitmentProof = { }, fromJSON(object: any): CommitmentProof { - const message = Object.create(baseCommitmentProof) as CommitmentProof; + const message = { ...baseCommitmentProof } as CommitmentProof; if (object.exist !== undefined && object.exist !== null) { message.exist = ExistenceProof.fromJSON(object.exist); } else { @@ -603,6 +609,18 @@ export const CommitmentProof = { return message; }, + toJSON(message: CommitmentProof): unknown { + const obj: any = {}; + message.exist !== undefined && + (obj.exist = message.exist ? ExistenceProof.toJSON(message.exist) : undefined); + message.nonexist !== undefined && + (obj.nonexist = message.nonexist ? NonExistenceProof.toJSON(message.nonexist) : undefined); + message.batch !== undefined && (obj.batch = message.batch ? BatchProof.toJSON(message.batch) : undefined); + message.compressed !== undefined && + (obj.compressed = message.compressed ? CompressedBatchProof.toJSON(message.compressed) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): CommitmentProof { const message = { ...baseCommitmentProof } as CommitmentProof; if (object.exist !== undefined && object.exist !== null) { @@ -627,36 +645,34 @@ export const CommitmentProof = { } return message; }, - - toJSON(message: CommitmentProof): unknown { - const obj: any = {}; - message.exist !== undefined && - (obj.exist = message.exist ? ExistenceProof.toJSON(message.exist) : undefined); - message.nonexist !== undefined && - (obj.nonexist = message.nonexist ? NonExistenceProof.toJSON(message.nonexist) : undefined); - message.batch !== undefined && (obj.batch = message.batch ? BatchProof.toJSON(message.batch) : undefined); - message.compressed !== undefined && - (obj.compressed = message.compressed ? CompressedBatchProof.toJSON(message.compressed) : undefined); - return obj; - }, }; const baseLeafOp: object = { hash: 0, prehashKey: 0, prehashValue: 0, length: 0 }; export const LeafOp = { encode(message: LeafOp, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).int32(message.hash); - writer.uint32(16).int32(message.prehashKey); - writer.uint32(24).int32(message.prehashValue); - writer.uint32(32).int32(message.length); - writer.uint32(42).bytes(message.prefix); + if (message.hash !== 0) { + writer.uint32(8).int32(message.hash); + } + if (message.prehashKey !== 0) { + writer.uint32(16).int32(message.prehashKey); + } + if (message.prehashValue !== 0) { + writer.uint32(24).int32(message.prehashValue); + } + if (message.length !== 0) { + writer.uint32(32).int32(message.length); + } + if (message.prefix.length !== 0) { + writer.uint32(42).bytes(message.prefix); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): LeafOp { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseLeafOp) as LeafOp; + const message = { ...baseLeafOp } as LeafOp; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -684,7 +700,7 @@ export const LeafOp = { }, fromJSON(object: any): LeafOp { - const message = Object.create(baseLeafOp) as LeafOp; + const message = { ...baseLeafOp } as LeafOp; if (object.hash !== undefined && object.hash !== null) { message.hash = hashOpFromJSON(object.hash); } else { @@ -711,6 +727,17 @@ export const LeafOp = { return message; }, + toJSON(message: LeafOp): unknown { + const obj: any = {}; + message.hash !== undefined && (obj.hash = hashOpToJSON(message.hash)); + message.prehashKey !== undefined && (obj.prehashKey = hashOpToJSON(message.prehashKey)); + message.prehashValue !== undefined && (obj.prehashValue = hashOpToJSON(message.prehashValue)); + message.length !== undefined && (obj.length = lengthOpToJSON(message.length)); + message.prefix !== undefined && + (obj.prefix = base64FromBytes(message.prefix !== undefined ? message.prefix : new Uint8Array())); + return obj; + }, + fromPartial(object: DeepPartial): LeafOp { const message = { ...baseLeafOp } as LeafOp; if (object.hash !== undefined && object.hash !== null) { @@ -740,33 +767,28 @@ export const LeafOp = { } return message; }, - - toJSON(message: LeafOp): unknown { - const obj: any = {}; - message.hash !== undefined && (obj.hash = hashOpToJSON(message.hash)); - message.prehashKey !== undefined && (obj.prehashKey = hashOpToJSON(message.prehashKey)); - message.prehashValue !== undefined && (obj.prehashValue = hashOpToJSON(message.prehashValue)); - message.length !== undefined && (obj.length = lengthOpToJSON(message.length)); - message.prefix !== undefined && - (obj.prefix = base64FromBytes(message.prefix !== undefined ? message.prefix : new Uint8Array())); - return obj; - }, }; const baseInnerOp: object = { hash: 0 }; export const InnerOp = { encode(message: InnerOp, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).int32(message.hash); - writer.uint32(18).bytes(message.prefix); - writer.uint32(26).bytes(message.suffix); + if (message.hash !== 0) { + writer.uint32(8).int32(message.hash); + } + if (message.prefix.length !== 0) { + writer.uint32(18).bytes(message.prefix); + } + if (message.suffix.length !== 0) { + writer.uint32(26).bytes(message.suffix); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): InnerOp { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseInnerOp) as InnerOp; + const message = { ...baseInnerOp } as InnerOp; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -788,7 +810,7 @@ export const InnerOp = { }, fromJSON(object: any): InnerOp { - const message = Object.create(baseInnerOp) as InnerOp; + const message = { ...baseInnerOp } as InnerOp; if (object.hash !== undefined && object.hash !== null) { message.hash = hashOpFromJSON(object.hash); } else { @@ -803,6 +825,16 @@ export const InnerOp = { return message; }, + toJSON(message: InnerOp): unknown { + const obj: any = {}; + message.hash !== undefined && (obj.hash = hashOpToJSON(message.hash)); + message.prefix !== undefined && + (obj.prefix = base64FromBytes(message.prefix !== undefined ? message.prefix : new Uint8Array())); + message.suffix !== undefined && + (obj.suffix = base64FromBytes(message.suffix !== undefined ? message.suffix : new Uint8Array())); + return obj; + }, + fromPartial(object: DeepPartial): InnerOp { const message = { ...baseInnerOp } as InnerOp; if (object.hash !== undefined && object.hash !== null) { @@ -822,16 +854,6 @@ export const InnerOp = { } return message; }, - - toJSON(message: InnerOp): unknown { - const obj: any = {}; - message.hash !== undefined && (obj.hash = hashOpToJSON(message.hash)); - message.prefix !== undefined && - (obj.prefix = base64FromBytes(message.prefix !== undefined ? message.prefix : new Uint8Array())); - message.suffix !== undefined && - (obj.suffix = base64FromBytes(message.suffix !== undefined ? message.suffix : new Uint8Array())); - return obj; - }, }; const baseProofSpec: object = { maxDepth: 0, minDepth: 0 }; @@ -844,15 +866,19 @@ export const ProofSpec = { if (message.innerSpec !== undefined) { InnerSpec.encode(message.innerSpec, writer.uint32(18).fork()).ldelim(); } - writer.uint32(24).int32(message.maxDepth); - writer.uint32(32).int32(message.minDepth); + if (message.maxDepth !== 0) { + writer.uint32(24).int32(message.maxDepth); + } + if (message.minDepth !== 0) { + writer.uint32(32).int32(message.minDepth); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): ProofSpec { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseProofSpec) as ProofSpec; + const message = { ...baseProofSpec } as ProofSpec; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -877,7 +903,7 @@ export const ProofSpec = { }, fromJSON(object: any): ProofSpec { - const message = Object.create(baseProofSpec) as ProofSpec; + const message = { ...baseProofSpec } as ProofSpec; if (object.leafSpec !== undefined && object.leafSpec !== null) { message.leafSpec = LeafOp.fromJSON(object.leafSpec); } else { @@ -901,6 +927,17 @@ export const ProofSpec = { return message; }, + toJSON(message: ProofSpec): unknown { + const obj: any = {}; + message.leafSpec !== undefined && + (obj.leafSpec = message.leafSpec ? LeafOp.toJSON(message.leafSpec) : undefined); + message.innerSpec !== undefined && + (obj.innerSpec = message.innerSpec ? InnerSpec.toJSON(message.innerSpec) : undefined); + message.maxDepth !== undefined && (obj.maxDepth = message.maxDepth); + message.minDepth !== undefined && (obj.minDepth = message.minDepth); + return obj; + }, + fromPartial(object: DeepPartial): ProofSpec { const message = { ...baseProofSpec } as ProofSpec; if (object.leafSpec !== undefined && object.leafSpec !== null) { @@ -925,17 +962,6 @@ export const ProofSpec = { } return message; }, - - toJSON(message: ProofSpec): unknown { - const obj: any = {}; - message.leafSpec !== undefined && - (obj.leafSpec = message.leafSpec ? LeafOp.toJSON(message.leafSpec) : undefined); - message.innerSpec !== undefined && - (obj.innerSpec = message.innerSpec ? InnerSpec.toJSON(message.innerSpec) : undefined); - message.maxDepth !== undefined && (obj.maxDepth = message.maxDepth); - message.minDepth !== undefined && (obj.minDepth = message.minDepth); - return obj; - }, }; const baseInnerSpec: object = { @@ -953,18 +979,28 @@ export const InnerSpec = { writer.int32(v); } writer.ldelim(); - writer.uint32(16).int32(message.childSize); - writer.uint32(24).int32(message.minPrefixLength); - writer.uint32(32).int32(message.maxPrefixLength); - writer.uint32(42).bytes(message.emptyChild); - writer.uint32(48).int32(message.hash); + if (message.childSize !== 0) { + writer.uint32(16).int32(message.childSize); + } + if (message.minPrefixLength !== 0) { + writer.uint32(24).int32(message.minPrefixLength); + } + if (message.maxPrefixLength !== 0) { + writer.uint32(32).int32(message.maxPrefixLength); + } + if (message.emptyChild.length !== 0) { + writer.uint32(42).bytes(message.emptyChild); + } + if (message.hash !== 0) { + writer.uint32(48).int32(message.hash); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): InnerSpec { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseInnerSpec) as InnerSpec; + const message = { ...baseInnerSpec } as InnerSpec; message.childOrder = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -1003,7 +1039,7 @@ export const InnerSpec = { }, fromJSON(object: any): InnerSpec { - const message = Object.create(baseInnerSpec) as InnerSpec; + const message = { ...baseInnerSpec } as InnerSpec; message.childOrder = []; if (object.childOrder !== undefined && object.childOrder !== null) { for (const e of object.childOrder) { @@ -1036,6 +1072,24 @@ export const InnerSpec = { return message; }, + toJSON(message: InnerSpec): unknown { + const obj: any = {}; + if (message.childOrder) { + obj.childOrder = message.childOrder.map((e) => e); + } else { + obj.childOrder = []; + } + message.childSize !== undefined && (obj.childSize = message.childSize); + message.minPrefixLength !== undefined && (obj.minPrefixLength = message.minPrefixLength); + message.maxPrefixLength !== undefined && (obj.maxPrefixLength = message.maxPrefixLength); + message.emptyChild !== undefined && + (obj.emptyChild = base64FromBytes( + message.emptyChild !== undefined ? message.emptyChild : new Uint8Array(), + )); + message.hash !== undefined && (obj.hash = hashOpToJSON(message.hash)); + return obj; + }, + fromPartial(object: DeepPartial): InnerSpec { const message = { ...baseInnerSpec } as InnerSpec; message.childOrder = []; @@ -1071,24 +1125,6 @@ export const InnerSpec = { } return message; }, - - toJSON(message: InnerSpec): unknown { - const obj: any = {}; - if (message.childOrder) { - obj.childOrder = message.childOrder.map((e) => e); - } else { - obj.childOrder = []; - } - message.childSize !== undefined && (obj.childSize = message.childSize); - message.minPrefixLength !== undefined && (obj.minPrefixLength = message.minPrefixLength); - message.maxPrefixLength !== undefined && (obj.maxPrefixLength = message.maxPrefixLength); - message.emptyChild !== undefined && - (obj.emptyChild = base64FromBytes( - message.emptyChild !== undefined ? message.emptyChild : new Uint8Array(), - )); - message.hash !== undefined && (obj.hash = hashOpToJSON(message.hash)); - return obj; - }, }; const baseBatchProof: object = {}; @@ -1104,7 +1140,7 @@ export const BatchProof = { decode(input: _m0.Reader | Uint8Array, length?: number): BatchProof { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseBatchProof) as BatchProof; + const message = { ...baseBatchProof } as BatchProof; message.entries = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -1121,22 +1157,11 @@ export const BatchProof = { }, fromJSON(object: any): BatchProof { - const message = Object.create(baseBatchProof) as BatchProof; - message.entries = []; - if (object.entries !== undefined && object.entries !== null) { - for (const e of object.entries) { - message.entries.push(BatchEntry.fromJSON(e)); - } - } - return message; - }, - - fromPartial(object: DeepPartial): BatchProof { const message = { ...baseBatchProof } as BatchProof; message.entries = []; if (object.entries !== undefined && object.entries !== null) { for (const e of object.entries) { - message.entries.push(BatchEntry.fromPartial(e)); + message.entries.push(BatchEntry.fromJSON(e)); } } return message; @@ -1151,6 +1176,17 @@ export const BatchProof = { } return obj; }, + + fromPartial(object: DeepPartial): BatchProof { + const message = { ...baseBatchProof } as BatchProof; + message.entries = []; + if (object.entries !== undefined && object.entries !== null) { + for (const e of object.entries) { + message.entries.push(BatchEntry.fromPartial(e)); + } + } + return message; + }, }; const baseBatchEntry: object = {}; @@ -1169,7 +1205,7 @@ export const BatchEntry = { decode(input: _m0.Reader | Uint8Array, length?: number): BatchEntry { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseBatchEntry) as BatchEntry; + const message = { ...baseBatchEntry } as BatchEntry; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1188,7 +1224,7 @@ export const BatchEntry = { }, fromJSON(object: any): BatchEntry { - const message = Object.create(baseBatchEntry) as BatchEntry; + const message = { ...baseBatchEntry } as BatchEntry; if (object.exist !== undefined && object.exist !== null) { message.exist = ExistenceProof.fromJSON(object.exist); } else { @@ -1202,6 +1238,15 @@ export const BatchEntry = { return message; }, + toJSON(message: BatchEntry): unknown { + const obj: any = {}; + message.exist !== undefined && + (obj.exist = message.exist ? ExistenceProof.toJSON(message.exist) : undefined); + message.nonexist !== undefined && + (obj.nonexist = message.nonexist ? NonExistenceProof.toJSON(message.nonexist) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): BatchEntry { const message = { ...baseBatchEntry } as BatchEntry; if (object.exist !== undefined && object.exist !== null) { @@ -1216,15 +1261,6 @@ export const BatchEntry = { } return message; }, - - toJSON(message: BatchEntry): unknown { - const obj: any = {}; - message.exist !== undefined && - (obj.exist = message.exist ? ExistenceProof.toJSON(message.exist) : undefined); - message.nonexist !== undefined && - (obj.nonexist = message.nonexist ? NonExistenceProof.toJSON(message.nonexist) : undefined); - return obj; - }, }; const baseCompressedBatchProof: object = {}; @@ -1243,7 +1279,7 @@ export const CompressedBatchProof = { decode(input: _m0.Reader | Uint8Array, length?: number): CompressedBatchProof { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseCompressedBatchProof) as CompressedBatchProof; + const message = { ...baseCompressedBatchProof } as CompressedBatchProof; message.entries = []; message.lookupInners = []; while (reader.pos < end) { @@ -1264,7 +1300,7 @@ export const CompressedBatchProof = { }, fromJSON(object: any): CompressedBatchProof { - const message = Object.create(baseCompressedBatchProof) as CompressedBatchProof; + const message = { ...baseCompressedBatchProof } as CompressedBatchProof; message.entries = []; message.lookupInners = []; if (object.entries !== undefined && object.entries !== null) { @@ -1280,23 +1316,6 @@ export const CompressedBatchProof = { return message; }, - fromPartial(object: DeepPartial): CompressedBatchProof { - const message = { ...baseCompressedBatchProof } as CompressedBatchProof; - message.entries = []; - message.lookupInners = []; - if (object.entries !== undefined && object.entries !== null) { - for (const e of object.entries) { - message.entries.push(CompressedBatchEntry.fromPartial(e)); - } - } - if (object.lookupInners !== undefined && object.lookupInners !== null) { - for (const e of object.lookupInners) { - message.lookupInners.push(InnerOp.fromPartial(e)); - } - } - return message; - }, - toJSON(message: CompressedBatchProof): unknown { const obj: any = {}; if (message.entries) { @@ -1311,6 +1330,23 @@ export const CompressedBatchProof = { } return obj; }, + + fromPartial(object: DeepPartial): CompressedBatchProof { + const message = { ...baseCompressedBatchProof } as CompressedBatchProof; + message.entries = []; + message.lookupInners = []; + if (object.entries !== undefined && object.entries !== null) { + for (const e of object.entries) { + message.entries.push(CompressedBatchEntry.fromPartial(e)); + } + } + if (object.lookupInners !== undefined && object.lookupInners !== null) { + for (const e of object.lookupInners) { + message.lookupInners.push(InnerOp.fromPartial(e)); + } + } + return message; + }, }; const baseCompressedBatchEntry: object = {}; @@ -1329,7 +1365,7 @@ export const CompressedBatchEntry = { decode(input: _m0.Reader | Uint8Array, length?: number): CompressedBatchEntry { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseCompressedBatchEntry) as CompressedBatchEntry; + const message = { ...baseCompressedBatchEntry } as CompressedBatchEntry; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1348,7 +1384,7 @@ export const CompressedBatchEntry = { }, fromJSON(object: any): CompressedBatchEntry { - const message = Object.create(baseCompressedBatchEntry) as CompressedBatchEntry; + const message = { ...baseCompressedBatchEntry } as CompressedBatchEntry; if (object.exist !== undefined && object.exist !== null) { message.exist = CompressedExistenceProof.fromJSON(object.exist); } else { @@ -1362,6 +1398,15 @@ export const CompressedBatchEntry = { return message; }, + toJSON(message: CompressedBatchEntry): unknown { + const obj: any = {}; + message.exist !== undefined && + (obj.exist = message.exist ? CompressedExistenceProof.toJSON(message.exist) : undefined); + message.nonexist !== undefined && + (obj.nonexist = message.nonexist ? CompressedNonExistenceProof.toJSON(message.nonexist) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): CompressedBatchEntry { const message = { ...baseCompressedBatchEntry } as CompressedBatchEntry; if (object.exist !== undefined && object.exist !== null) { @@ -1376,23 +1421,18 @@ export const CompressedBatchEntry = { } return message; }, - - toJSON(message: CompressedBatchEntry): unknown { - const obj: any = {}; - message.exist !== undefined && - (obj.exist = message.exist ? CompressedExistenceProof.toJSON(message.exist) : undefined); - message.nonexist !== undefined && - (obj.nonexist = message.nonexist ? CompressedNonExistenceProof.toJSON(message.nonexist) : undefined); - return obj; - }, }; const baseCompressedExistenceProof: object = { path: 0 }; export const CompressedExistenceProof = { encode(message: CompressedExistenceProof, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).bytes(message.key); - writer.uint32(18).bytes(message.value); + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } if (message.leaf !== undefined) { LeafOp.encode(message.leaf, writer.uint32(26).fork()).ldelim(); } @@ -1407,7 +1447,7 @@ export const CompressedExistenceProof = { decode(input: _m0.Reader | Uint8Array, length?: number): CompressedExistenceProof { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseCompressedExistenceProof) as CompressedExistenceProof; + const message = { ...baseCompressedExistenceProof } as CompressedExistenceProof; message.path = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -1440,7 +1480,7 @@ export const CompressedExistenceProof = { }, fromJSON(object: any): CompressedExistenceProof { - const message = Object.create(baseCompressedExistenceProof) as CompressedExistenceProof; + const message = { ...baseCompressedExistenceProof } as CompressedExistenceProof; message.path = []; if (object.key !== undefined && object.key !== null) { message.key = bytesFromBase64(object.key); @@ -1461,6 +1501,21 @@ export const CompressedExistenceProof = { return message; }, + toJSON(message: CompressedExistenceProof): unknown { + const obj: any = {}; + message.key !== undefined && + (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); + message.value !== undefined && + (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); + message.leaf !== undefined && (obj.leaf = message.leaf ? LeafOp.toJSON(message.leaf) : undefined); + if (message.path) { + obj.path = message.path.map((e) => e); + } else { + obj.path = []; + } + return obj; + }, + fromPartial(object: DeepPartial): CompressedExistenceProof { const message = { ...baseCompressedExistenceProof } as CompressedExistenceProof; message.path = []; @@ -1486,28 +1541,15 @@ export const CompressedExistenceProof = { } return message; }, - - toJSON(message: CompressedExistenceProof): unknown { - const obj: any = {}; - message.key !== undefined && - (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); - message.value !== undefined && - (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); - message.leaf !== undefined && (obj.leaf = message.leaf ? LeafOp.toJSON(message.leaf) : undefined); - if (message.path) { - obj.path = message.path.map((e) => e); - } else { - obj.path = []; - } - return obj; - }, }; const baseCompressedNonExistenceProof: object = {}; export const CompressedNonExistenceProof = { encode(message: CompressedNonExistenceProof, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).bytes(message.key); + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } if (message.left !== undefined) { CompressedExistenceProof.encode(message.left, writer.uint32(18).fork()).ldelim(); } @@ -1520,7 +1562,7 @@ export const CompressedNonExistenceProof = { decode(input: _m0.Reader | Uint8Array, length?: number): CompressedNonExistenceProof { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseCompressedNonExistenceProof) as CompressedNonExistenceProof; + const message = { ...baseCompressedNonExistenceProof } as CompressedNonExistenceProof; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1542,7 +1584,7 @@ export const CompressedNonExistenceProof = { }, fromJSON(object: any): CompressedNonExistenceProof { - const message = Object.create(baseCompressedNonExistenceProof) as CompressedNonExistenceProof; + const message = { ...baseCompressedNonExistenceProof } as CompressedNonExistenceProof; if (object.key !== undefined && object.key !== null) { message.key = bytesFromBase64(object.key); } @@ -1559,6 +1601,17 @@ export const CompressedNonExistenceProof = { return message; }, + toJSON(message: CompressedNonExistenceProof): unknown { + const obj: any = {}; + message.key !== undefined && + (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); + message.left !== undefined && + (obj.left = message.left ? CompressedExistenceProof.toJSON(message.left) : undefined); + message.right !== undefined && + (obj.right = message.right ? CompressedExistenceProof.toJSON(message.right) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): CompressedNonExistenceProof { const message = { ...baseCompressedNonExistenceProof } as CompressedNonExistenceProof; if (object.key !== undefined && object.key !== null) { @@ -1578,17 +1631,6 @@ export const CompressedNonExistenceProof = { } return message; }, - - toJSON(message: CompressedNonExistenceProof): unknown { - const obj: any = {}; - message.key !== undefined && - (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); - message.left !== undefined && - (obj.left = message.left ? CompressedExistenceProof.toJSON(message.left) : undefined); - message.right !== undefined && - (obj.right = message.right ? CompressedExistenceProof.toJSON(message.right) : undefined); - return obj; - }, }; declare var self: any | undefined; @@ -1598,7 +1640,7 @@ var globalThis: any = (() => { if (typeof self !== "undefined") return self; if (typeof window !== "undefined") return window; if (typeof global !== "undefined") return global; - throw new Error("Unable to locate global object"); + throw "Unable to locate global object"; })(); const atob: (b64: string) => string = diff --git a/packages/stargate/src/codec/cosmos/auth/v1beta1/auth.ts b/packages/stargate/src/codec/cosmos/auth/v1beta1/auth.ts index 6d9e2e82..886ff5b9 100644 --- a/packages/stargate/src/codec/cosmos/auth/v1beta1/auth.ts +++ b/packages/stargate/src/codec/cosmos/auth/v1beta1/auth.ts @@ -37,19 +37,25 @@ const baseBaseAccount: object = { address: "", accountNumber: Long.UZERO, sequen export const BaseAccount = { encode(message: BaseAccount, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.address); + if (message.address !== "") { + writer.uint32(10).string(message.address); + } if (message.pubKey !== undefined) { Any.encode(message.pubKey, writer.uint32(18).fork()).ldelim(); } - writer.uint32(24).uint64(message.accountNumber); - writer.uint32(32).uint64(message.sequence); + if (!message.accountNumber.isZero()) { + writer.uint32(24).uint64(message.accountNumber); + } + if (!message.sequence.isZero()) { + writer.uint32(32).uint64(message.sequence); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): BaseAccount { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseBaseAccount) as BaseAccount; + const message = { ...baseBaseAccount } as BaseAccount; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -74,7 +80,7 @@ export const BaseAccount = { }, fromJSON(object: any): BaseAccount { - const message = Object.create(baseBaseAccount) as BaseAccount; + const message = { ...baseBaseAccount } as BaseAccount; if (object.address !== undefined && object.address !== null) { message.address = String(object.address); } else { @@ -98,6 +104,16 @@ export const BaseAccount = { return message; }, + toJSON(message: BaseAccount): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.pubKey !== undefined && (obj.pubKey = message.pubKey ? Any.toJSON(message.pubKey) : undefined); + message.accountNumber !== undefined && + (obj.accountNumber = (message.accountNumber || Long.UZERO).toString()); + message.sequence !== undefined && (obj.sequence = (message.sequence || Long.UZERO).toString()); + return obj; + }, + fromPartial(object: DeepPartial): BaseAccount { const message = { ...baseBaseAccount } as BaseAccount; if (object.address !== undefined && object.address !== null) { @@ -122,16 +138,6 @@ export const BaseAccount = { } return message; }, - - toJSON(message: BaseAccount): unknown { - const obj: any = {}; - message.address !== undefined && (obj.address = message.address); - message.pubKey !== undefined && (obj.pubKey = message.pubKey ? Any.toJSON(message.pubKey) : undefined); - message.accountNumber !== undefined && - (obj.accountNumber = (message.accountNumber || Long.UZERO).toString()); - message.sequence !== undefined && (obj.sequence = (message.sequence || Long.UZERO).toString()); - return obj; - }, }; const baseModuleAccount: object = { name: "", permissions: "" }; @@ -141,7 +147,9 @@ export const ModuleAccount = { if (message.baseAccount !== undefined) { BaseAccount.encode(message.baseAccount, writer.uint32(10).fork()).ldelim(); } - writer.uint32(18).string(message.name); + if (message.name !== "") { + writer.uint32(18).string(message.name); + } for (const v of message.permissions) { writer.uint32(26).string(v!); } @@ -151,7 +159,7 @@ export const ModuleAccount = { decode(input: _m0.Reader | Uint8Array, length?: number): ModuleAccount { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseModuleAccount) as ModuleAccount; + const message = { ...baseModuleAccount } as ModuleAccount; message.permissions = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -174,7 +182,7 @@ export const ModuleAccount = { }, fromJSON(object: any): ModuleAccount { - const message = Object.create(baseModuleAccount) as ModuleAccount; + const message = { ...baseModuleAccount } as ModuleAccount; message.permissions = []; if (object.baseAccount !== undefined && object.baseAccount !== null) { message.baseAccount = BaseAccount.fromJSON(object.baseAccount); @@ -194,6 +202,19 @@ export const ModuleAccount = { return message; }, + toJSON(message: ModuleAccount): unknown { + const obj: any = {}; + message.baseAccount !== undefined && + (obj.baseAccount = message.baseAccount ? BaseAccount.toJSON(message.baseAccount) : undefined); + message.name !== undefined && (obj.name = message.name); + if (message.permissions) { + obj.permissions = message.permissions.map((e) => e); + } else { + obj.permissions = []; + } + return obj; + }, + fromPartial(object: DeepPartial): ModuleAccount { const message = { ...baseModuleAccount } as ModuleAccount; message.permissions = []; @@ -214,19 +235,6 @@ export const ModuleAccount = { } return message; }, - - toJSON(message: ModuleAccount): unknown { - const obj: any = {}; - message.baseAccount !== undefined && - (obj.baseAccount = message.baseAccount ? BaseAccount.toJSON(message.baseAccount) : undefined); - message.name !== undefined && (obj.name = message.name); - if (message.permissions) { - obj.permissions = message.permissions.map((e) => e); - } else { - obj.permissions = []; - } - return obj; - }, }; const baseParams: object = { @@ -239,18 +247,28 @@ const baseParams: object = { export const Params = { encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).uint64(message.maxMemoCharacters); - writer.uint32(16).uint64(message.txSigLimit); - writer.uint32(24).uint64(message.txSizeCostPerByte); - writer.uint32(32).uint64(message.sigVerifyCostEd25519); - writer.uint32(40).uint64(message.sigVerifyCostSecp256k1); + if (!message.maxMemoCharacters.isZero()) { + writer.uint32(8).uint64(message.maxMemoCharacters); + } + if (!message.txSigLimit.isZero()) { + writer.uint32(16).uint64(message.txSigLimit); + } + if (!message.txSizeCostPerByte.isZero()) { + writer.uint32(24).uint64(message.txSizeCostPerByte); + } + if (!message.sigVerifyCostEd25519.isZero()) { + writer.uint32(32).uint64(message.sigVerifyCostEd25519); + } + if (!message.sigVerifyCostSecp256k1.isZero()) { + writer.uint32(40).uint64(message.sigVerifyCostSecp256k1); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): Params { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseParams) as Params; + const message = { ...baseParams } as Params; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -278,7 +296,7 @@ export const Params = { }, fromJSON(object: any): Params { - const message = Object.create(baseParams) as Params; + const message = { ...baseParams } as Params; if (object.maxMemoCharacters !== undefined && object.maxMemoCharacters !== null) { message.maxMemoCharacters = Long.fromString(object.maxMemoCharacters); } else { @@ -307,6 +325,20 @@ export const Params = { return message; }, + toJSON(message: Params): unknown { + const obj: any = {}; + message.maxMemoCharacters !== undefined && + (obj.maxMemoCharacters = (message.maxMemoCharacters || Long.UZERO).toString()); + message.txSigLimit !== undefined && (obj.txSigLimit = (message.txSigLimit || Long.UZERO).toString()); + message.txSizeCostPerByte !== undefined && + (obj.txSizeCostPerByte = (message.txSizeCostPerByte || Long.UZERO).toString()); + message.sigVerifyCostEd25519 !== undefined && + (obj.sigVerifyCostEd25519 = (message.sigVerifyCostEd25519 || Long.UZERO).toString()); + message.sigVerifyCostSecp256k1 !== undefined && + (obj.sigVerifyCostSecp256k1 = (message.sigVerifyCostSecp256k1 || Long.UZERO).toString()); + return obj; + }, + fromPartial(object: DeepPartial): Params { const message = { ...baseParams } as Params; if (object.maxMemoCharacters !== undefined && object.maxMemoCharacters !== null) { @@ -336,20 +368,6 @@ export const Params = { } return message; }, - - toJSON(message: Params): unknown { - const obj: any = {}; - message.maxMemoCharacters !== undefined && - (obj.maxMemoCharacters = (message.maxMemoCharacters || Long.UZERO).toString()); - message.txSigLimit !== undefined && (obj.txSigLimit = (message.txSigLimit || Long.UZERO).toString()); - message.txSizeCostPerByte !== undefined && - (obj.txSizeCostPerByte = (message.txSizeCostPerByte || Long.UZERO).toString()); - message.sigVerifyCostEd25519 !== undefined && - (obj.sigVerifyCostEd25519 = (message.sigVerifyCostEd25519 || Long.UZERO).toString()); - message.sigVerifyCostSecp256k1 !== undefined && - (obj.sigVerifyCostSecp256k1 = (message.sigVerifyCostSecp256k1 || Long.UZERO).toString()); - return obj; - }, }; type Builtin = Date | Function | Uint8Array | string | number | undefined | Long; diff --git a/packages/stargate/src/codec/cosmos/auth/v1beta1/query.ts b/packages/stargate/src/codec/cosmos/auth/v1beta1/query.ts index a6c36a37..cc5cc5f1 100644 --- a/packages/stargate/src/codec/cosmos/auth/v1beta1/query.ts +++ b/packages/stargate/src/codec/cosmos/auth/v1beta1/query.ts @@ -31,14 +31,16 @@ const baseQueryAccountRequest: object = { address: "" }; export const QueryAccountRequest = { encode(message: QueryAccountRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.address); + if (message.address !== "") { + writer.uint32(10).string(message.address); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryAccountRequest) as QueryAccountRequest; + const message = { ...baseQueryAccountRequest } as QueryAccountRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -54,19 +56,9 @@ export const QueryAccountRequest = { }, fromJSON(object: any): QueryAccountRequest { - const message = Object.create(baseQueryAccountRequest) as QueryAccountRequest; - if (object.address !== undefined && object.address !== null) { - message.address = String(object.address); - } else { - message.address = ""; - } - return message; - }, - - fromPartial(object: DeepPartial): QueryAccountRequest { const message = { ...baseQueryAccountRequest } as QueryAccountRequest; if (object.address !== undefined && object.address !== null) { - message.address = object.address; + message.address = String(object.address); } else { message.address = ""; } @@ -78,6 +70,16 @@ export const QueryAccountRequest = { message.address !== undefined && (obj.address = message.address); return obj; }, + + fromPartial(object: DeepPartial): QueryAccountRequest { + const message = { ...baseQueryAccountRequest } as QueryAccountRequest; + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } else { + message.address = ""; + } + return message; + }, }; const baseQueryAccountResponse: object = {}; @@ -93,7 +95,7 @@ export const QueryAccountResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryAccountResponse) as QueryAccountResponse; + const message = { ...baseQueryAccountResponse } as QueryAccountResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -109,19 +111,9 @@ export const QueryAccountResponse = { }, fromJSON(object: any): QueryAccountResponse { - const message = Object.create(baseQueryAccountResponse) as QueryAccountResponse; - if (object.account !== undefined && object.account !== null) { - message.account = Any.fromJSON(object.account); - } else { - message.account = undefined; - } - return message; - }, - - fromPartial(object: DeepPartial): QueryAccountResponse { const message = { ...baseQueryAccountResponse } as QueryAccountResponse; if (object.account !== undefined && object.account !== null) { - message.account = Any.fromPartial(object.account); + message.account = Any.fromJSON(object.account); } else { message.account = undefined; } @@ -134,6 +126,16 @@ export const QueryAccountResponse = { (obj.account = message.account ? Any.toJSON(message.account) : undefined); return obj; }, + + fromPartial(object: DeepPartial): QueryAccountResponse { + const message = { ...baseQueryAccountResponse } as QueryAccountResponse; + if (object.account !== undefined && object.account !== null) { + message.account = Any.fromPartial(object.account); + } else { + message.account = undefined; + } + return message; + }, }; const baseQueryParamsRequest: object = {}; @@ -146,7 +148,7 @@ export const QueryParamsRequest = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryParamsRequest) as QueryParamsRequest; + const message = { ...baseQueryParamsRequest } as QueryParamsRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -159,11 +161,6 @@ export const QueryParamsRequest = { }, fromJSON(_: any): QueryParamsRequest { - const message = Object.create(baseQueryParamsRequest) as QueryParamsRequest; - return message; - }, - - fromPartial(_: DeepPartial): QueryParamsRequest { const message = { ...baseQueryParamsRequest } as QueryParamsRequest; return message; }, @@ -172,6 +169,11 @@ export const QueryParamsRequest = { const obj: any = {}; return obj; }, + + fromPartial(_: DeepPartial): QueryParamsRequest { + const message = { ...baseQueryParamsRequest } as QueryParamsRequest; + return message; + }, }; const baseQueryParamsResponse: object = {}; @@ -187,7 +189,7 @@ export const QueryParamsResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryParamsResponse) as QueryParamsResponse; + const message = { ...baseQueryParamsResponse } as QueryParamsResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -203,19 +205,9 @@ export const QueryParamsResponse = { }, fromJSON(object: any): QueryParamsResponse { - const message = Object.create(baseQueryParamsResponse) as QueryParamsResponse; - if (object.params !== undefined && object.params !== null) { - message.params = Params.fromJSON(object.params); - } else { - message.params = undefined; - } - return message; - }, - - fromPartial(object: DeepPartial): QueryParamsResponse { const message = { ...baseQueryParamsResponse } as QueryParamsResponse; if (object.params !== undefined && object.params !== null) { - message.params = Params.fromPartial(object.params); + message.params = Params.fromJSON(object.params); } else { message.params = undefined; } @@ -227,6 +219,16 @@ export const QueryParamsResponse = { message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); 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; + } + return message; + }, }; /** Query defines the gRPC querier service. */ diff --git a/packages/stargate/src/codec/cosmos/bank/v1beta1/bank.ts b/packages/stargate/src/codec/cosmos/bank/v1beta1/bank.ts index 7c2e0e02..43fa84f5 100644 --- a/packages/stargate/src/codec/cosmos/bank/v1beta1/bank.ts +++ b/packages/stargate/src/codec/cosmos/bank/v1beta1/bank.ts @@ -83,14 +83,16 @@ export const Params = { for (const v of message.sendEnabled) { SendEnabled.encode(v!, writer.uint32(10).fork()).ldelim(); } - writer.uint32(16).bool(message.defaultSendEnabled); + if (message.defaultSendEnabled === true) { + writer.uint32(16).bool(message.defaultSendEnabled); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): Params { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseParams) as Params; + const message = { ...baseParams } as Params; message.sendEnabled = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -110,7 +112,7 @@ export const Params = { }, fromJSON(object: any): Params { - const message = Object.create(baseParams) as Params; + const message = { ...baseParams } as Params; message.sendEnabled = []; if (object.sendEnabled !== undefined && object.sendEnabled !== null) { for (const e of object.sendEnabled) { @@ -125,6 +127,17 @@ export const Params = { return message; }, + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.sendEnabled) { + obj.sendEnabled = message.sendEnabled.map((e) => (e ? SendEnabled.toJSON(e) : undefined)); + } else { + obj.sendEnabled = []; + } + message.defaultSendEnabled !== undefined && (obj.defaultSendEnabled = message.defaultSendEnabled); + return obj; + }, + fromPartial(object: DeepPartial): Params { const message = { ...baseParams } as Params; message.sendEnabled = []; @@ -140,32 +153,25 @@ export const Params = { } return message; }, - - toJSON(message: Params): unknown { - const obj: any = {}; - if (message.sendEnabled) { - obj.sendEnabled = message.sendEnabled.map((e) => (e ? SendEnabled.toJSON(e) : undefined)); - } else { - obj.sendEnabled = []; - } - message.defaultSendEnabled !== undefined && (obj.defaultSendEnabled = message.defaultSendEnabled); - return obj; - }, }; const baseSendEnabled: object = { denom: "", enabled: false }; export const SendEnabled = { encode(message: SendEnabled, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.denom); - writer.uint32(16).bool(message.enabled); + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.enabled === true) { + writer.uint32(16).bool(message.enabled); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): SendEnabled { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseSendEnabled) as SendEnabled; + const message = { ...baseSendEnabled } as SendEnabled; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -184,7 +190,7 @@ export const SendEnabled = { }, fromJSON(object: any): SendEnabled { - const message = Object.create(baseSendEnabled) as SendEnabled; + const message = { ...baseSendEnabled } as SendEnabled; if (object.denom !== undefined && object.denom !== null) { message.denom = String(object.denom); } else { @@ -198,6 +204,13 @@ export const SendEnabled = { return message; }, + toJSON(message: SendEnabled): unknown { + const obj: any = {}; + message.denom !== undefined && (obj.denom = message.denom); + message.enabled !== undefined && (obj.enabled = message.enabled); + return obj; + }, + fromPartial(object: DeepPartial): SendEnabled { const message = { ...baseSendEnabled } as SendEnabled; if (object.denom !== undefined && object.denom !== null) { @@ -212,20 +225,15 @@ export const SendEnabled = { } return message; }, - - toJSON(message: SendEnabled): unknown { - const obj: any = {}; - message.denom !== undefined && (obj.denom = message.denom); - message.enabled !== undefined && (obj.enabled = message.enabled); - return obj; - }, }; const baseInput: object = { address: "" }; export const Input = { encode(message: Input, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.address); + if (message.address !== "") { + writer.uint32(10).string(message.address); + } for (const v of message.coins) { Coin.encode(v!, writer.uint32(18).fork()).ldelim(); } @@ -235,7 +243,7 @@ export const Input = { decode(input: _m0.Reader | Uint8Array, length?: number): Input { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseInput) as Input; + const message = { ...baseInput } as Input; message.coins = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -255,7 +263,7 @@ export const Input = { }, fromJSON(object: any): Input { - const message = Object.create(baseInput) as Input; + const message = { ...baseInput } as Input; message.coins = []; if (object.address !== undefined && object.address !== null) { message.address = String(object.address); @@ -270,6 +278,17 @@ export const Input = { return message; }, + toJSON(message: Input): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + if (message.coins) { + obj.coins = message.coins.map((e) => (e ? Coin.toJSON(e) : undefined)); + } else { + obj.coins = []; + } + return obj; + }, + fromPartial(object: DeepPartial): Input { const message = { ...baseInput } as Input; message.coins = []; @@ -285,24 +304,15 @@ export const Input = { } return message; }, - - toJSON(message: Input): unknown { - const obj: any = {}; - message.address !== undefined && (obj.address = message.address); - if (message.coins) { - obj.coins = message.coins.map((e) => (e ? Coin.toJSON(e) : undefined)); - } else { - obj.coins = []; - } - return obj; - }, }; const baseOutput: object = { address: "" }; export const Output = { encode(message: Output, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.address); + if (message.address !== "") { + writer.uint32(10).string(message.address); + } for (const v of message.coins) { Coin.encode(v!, writer.uint32(18).fork()).ldelim(); } @@ -312,7 +322,7 @@ export const Output = { decode(input: _m0.Reader | Uint8Array, length?: number): Output { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseOutput) as Output; + const message = { ...baseOutput } as Output; message.coins = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -332,7 +342,7 @@ export const Output = { }, fromJSON(object: any): Output { - const message = Object.create(baseOutput) as Output; + const message = { ...baseOutput } as Output; message.coins = []; if (object.address !== undefined && object.address !== null) { message.address = String(object.address); @@ -347,6 +357,17 @@ export const Output = { return message; }, + toJSON(message: Output): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + if (message.coins) { + obj.coins = message.coins.map((e) => (e ? Coin.toJSON(e) : undefined)); + } else { + obj.coins = []; + } + return obj; + }, + fromPartial(object: DeepPartial): Output { const message = { ...baseOutput } as Output; message.coins = []; @@ -362,17 +383,6 @@ export const Output = { } return message; }, - - toJSON(message: Output): unknown { - const obj: any = {}; - message.address !== undefined && (obj.address = message.address); - if (message.coins) { - obj.coins = message.coins.map((e) => (e ? Coin.toJSON(e) : undefined)); - } else { - obj.coins = []; - } - return obj; - }, }; const baseSupply: object = {}; @@ -388,7 +398,7 @@ export const Supply = { decode(input: _m0.Reader | Uint8Array, length?: number): Supply { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseSupply) as Supply; + const message = { ...baseSupply } as Supply; message.total = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -405,22 +415,11 @@ export const Supply = { }, fromJSON(object: any): Supply { - const message = Object.create(baseSupply) as Supply; - message.total = []; - if (object.total !== undefined && object.total !== null) { - for (const e of object.total) { - message.total.push(Coin.fromJSON(e)); - } - } - return message; - }, - - fromPartial(object: DeepPartial): Supply { const message = { ...baseSupply } as Supply; message.total = []; if (object.total !== undefined && object.total !== null) { for (const e of object.total) { - message.total.push(Coin.fromPartial(e)); + message.total.push(Coin.fromJSON(e)); } } return message; @@ -435,14 +434,29 @@ export const Supply = { } return obj; }, + + fromPartial(object: DeepPartial): Supply { + const message = { ...baseSupply } as Supply; + message.total = []; + if (object.total !== undefined && object.total !== null) { + for (const e of object.total) { + message.total.push(Coin.fromPartial(e)); + } + } + return message; + }, }; const baseDenomUnit: object = { denom: "", exponent: 0, aliases: "" }; export const DenomUnit = { encode(message: DenomUnit, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.denom); - writer.uint32(16).uint32(message.exponent); + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.exponent !== 0) { + writer.uint32(16).uint32(message.exponent); + } for (const v of message.aliases) { writer.uint32(26).string(v!); } @@ -452,7 +466,7 @@ export const DenomUnit = { decode(input: _m0.Reader | Uint8Array, length?: number): DenomUnit { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseDenomUnit) as DenomUnit; + const message = { ...baseDenomUnit } as DenomUnit; message.aliases = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -475,7 +489,7 @@ export const DenomUnit = { }, fromJSON(object: any): DenomUnit { - const message = Object.create(baseDenomUnit) as DenomUnit; + const message = { ...baseDenomUnit } as DenomUnit; message.aliases = []; if (object.denom !== undefined && object.denom !== null) { message.denom = String(object.denom); @@ -495,6 +509,18 @@ export const DenomUnit = { return message; }, + toJSON(message: DenomUnit): unknown { + const obj: any = {}; + message.denom !== undefined && (obj.denom = message.denom); + message.exponent !== undefined && (obj.exponent = message.exponent); + if (message.aliases) { + obj.aliases = message.aliases.map((e) => e); + } else { + obj.aliases = []; + } + return obj; + }, + fromPartial(object: DeepPartial): DenomUnit { const message = { ...baseDenomUnit } as DenomUnit; message.aliases = []; @@ -515,37 +541,31 @@ export const DenomUnit = { } return message; }, - - toJSON(message: DenomUnit): unknown { - const obj: any = {}; - message.denom !== undefined && (obj.denom = message.denom); - message.exponent !== undefined && (obj.exponent = message.exponent); - if (message.aliases) { - obj.aliases = message.aliases.map((e) => e); - } else { - obj.aliases = []; - } - return obj; - }, }; const baseMetadata: object = { description: "", base: "", display: "" }; export const Metadata = { encode(message: Metadata, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.description); + if (message.description !== "") { + writer.uint32(10).string(message.description); + } for (const v of message.denomUnits) { DenomUnit.encode(v!, writer.uint32(18).fork()).ldelim(); } - writer.uint32(26).string(message.base); - writer.uint32(34).string(message.display); + if (message.base !== "") { + writer.uint32(26).string(message.base); + } + if (message.display !== "") { + writer.uint32(34).string(message.display); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): Metadata { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseMetadata) as Metadata; + const message = { ...baseMetadata } as Metadata; message.denomUnits = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -571,7 +591,7 @@ export const Metadata = { }, fromJSON(object: any): Metadata { - const message = Object.create(baseMetadata) as Metadata; + const message = { ...baseMetadata } as Metadata; message.denomUnits = []; if (object.description !== undefined && object.description !== null) { message.description = String(object.description); @@ -596,6 +616,19 @@ export const Metadata = { return message; }, + toJSON(message: Metadata): unknown { + const obj: any = {}; + message.description !== undefined && (obj.description = message.description); + if (message.denomUnits) { + obj.denomUnits = message.denomUnits.map((e) => (e ? DenomUnit.toJSON(e) : undefined)); + } else { + obj.denomUnits = []; + } + message.base !== undefined && (obj.base = message.base); + message.display !== undefined && (obj.display = message.display); + return obj; + }, + fromPartial(object: DeepPartial): Metadata { const message = { ...baseMetadata } as Metadata; message.denomUnits = []; @@ -621,19 +654,6 @@ export const Metadata = { } return message; }, - - toJSON(message: Metadata): unknown { - const obj: any = {}; - message.description !== undefined && (obj.description = message.description); - if (message.denomUnits) { - obj.denomUnits = message.denomUnits.map((e) => (e ? DenomUnit.toJSON(e) : undefined)); - } else { - obj.denomUnits = []; - } - message.base !== undefined && (obj.base = message.base); - message.display !== undefined && (obj.display = message.display); - return obj; - }, }; type Builtin = Date | Function | Uint8Array | string | number | undefined | Long; diff --git a/packages/stargate/src/codec/cosmos/bank/v1beta1/query.ts b/packages/stargate/src/codec/cosmos/bank/v1beta1/query.ts index 5ba08c1a..b1e07e2f 100644 --- a/packages/stargate/src/codec/cosmos/bank/v1beta1/query.ts +++ b/packages/stargate/src/codec/cosmos/bank/v1beta1/query.ts @@ -79,15 +79,19 @@ const baseQueryBalanceRequest: object = { address: "", denom: "" }; export const QueryBalanceRequest = { encode(message: QueryBalanceRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.address); - writer.uint32(18).string(message.denom); + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryBalanceRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryBalanceRequest) as QueryBalanceRequest; + const message = { ...baseQueryBalanceRequest } as QueryBalanceRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -106,7 +110,7 @@ export const QueryBalanceRequest = { }, fromJSON(object: any): QueryBalanceRequest { - const message = Object.create(baseQueryBalanceRequest) as QueryBalanceRequest; + const message = { ...baseQueryBalanceRequest } as QueryBalanceRequest; if (object.address !== undefined && object.address !== null) { message.address = String(object.address); } else { @@ -120,6 +124,13 @@ export const QueryBalanceRequest = { return message; }, + toJSON(message: QueryBalanceRequest): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.denom !== undefined && (obj.denom = message.denom); + return obj; + }, + fromPartial(object: DeepPartial): QueryBalanceRequest { const message = { ...baseQueryBalanceRequest } as QueryBalanceRequest; if (object.address !== undefined && object.address !== null) { @@ -134,13 +145,6 @@ export const QueryBalanceRequest = { } return message; }, - - toJSON(message: QueryBalanceRequest): unknown { - const obj: any = {}; - message.address !== undefined && (obj.address = message.address); - message.denom !== undefined && (obj.denom = message.denom); - return obj; - }, }; const baseQueryBalanceResponse: object = {}; @@ -156,7 +160,7 @@ export const QueryBalanceResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryBalanceResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryBalanceResponse) as QueryBalanceResponse; + const message = { ...baseQueryBalanceResponse } as QueryBalanceResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -172,19 +176,9 @@ export const QueryBalanceResponse = { }, fromJSON(object: any): QueryBalanceResponse { - const message = Object.create(baseQueryBalanceResponse) as QueryBalanceResponse; - if (object.balance !== undefined && object.balance !== null) { - message.balance = Coin.fromJSON(object.balance); - } else { - message.balance = undefined; - } - return message; - }, - - fromPartial(object: DeepPartial): QueryBalanceResponse { const message = { ...baseQueryBalanceResponse } as QueryBalanceResponse; if (object.balance !== undefined && object.balance !== null) { - message.balance = Coin.fromPartial(object.balance); + message.balance = Coin.fromJSON(object.balance); } else { message.balance = undefined; } @@ -197,13 +191,25 @@ export const QueryBalanceResponse = { (obj.balance = message.balance ? Coin.toJSON(message.balance) : undefined); return obj; }, + + fromPartial(object: DeepPartial): QueryBalanceResponse { + const message = { ...baseQueryBalanceResponse } as QueryBalanceResponse; + if (object.balance !== undefined && object.balance !== null) { + message.balance = Coin.fromPartial(object.balance); + } else { + message.balance = undefined; + } + return message; + }, }; const baseQueryAllBalancesRequest: object = { address: "" }; export const QueryAllBalancesRequest = { encode(message: QueryAllBalancesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.address); + if (message.address !== "") { + writer.uint32(10).string(message.address); + } if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } @@ -213,7 +219,7 @@ export const QueryAllBalancesRequest = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllBalancesRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryAllBalancesRequest) as QueryAllBalancesRequest; + const message = { ...baseQueryAllBalancesRequest } as QueryAllBalancesRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -232,7 +238,7 @@ export const QueryAllBalancesRequest = { }, fromJSON(object: any): QueryAllBalancesRequest { - const message = Object.create(baseQueryAllBalancesRequest) as QueryAllBalancesRequest; + const message = { ...baseQueryAllBalancesRequest } as QueryAllBalancesRequest; if (object.address !== undefined && object.address !== null) { message.address = String(object.address); } else { @@ -246,6 +252,14 @@ export const QueryAllBalancesRequest = { return message; }, + toJSON(message: QueryAllBalancesRequest): unknown { + const obj: any = {}; + message.address !== undefined && (obj.address = message.address); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): QueryAllBalancesRequest { const message = { ...baseQueryAllBalancesRequest } as QueryAllBalancesRequest; if (object.address !== undefined && object.address !== null) { @@ -260,14 +274,6 @@ export const QueryAllBalancesRequest = { } return message; }, - - toJSON(message: QueryAllBalancesRequest): unknown { - const obj: any = {}; - message.address !== undefined && (obj.address = message.address); - message.pagination !== undefined && - (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); - return obj; - }, }; const baseQueryAllBalancesResponse: object = {}; @@ -286,7 +292,7 @@ export const QueryAllBalancesResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllBalancesResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryAllBalancesResponse) as QueryAllBalancesResponse; + const message = { ...baseQueryAllBalancesResponse } as QueryAllBalancesResponse; message.balances = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -306,7 +312,7 @@ export const QueryAllBalancesResponse = { }, fromJSON(object: any): QueryAllBalancesResponse { - const message = Object.create(baseQueryAllBalancesResponse) as QueryAllBalancesResponse; + const message = { ...baseQueryAllBalancesResponse } as QueryAllBalancesResponse; message.balances = []; if (object.balances !== undefined && object.balances !== null) { for (const e of object.balances) { @@ -321,22 +327,6 @@ export const QueryAllBalancesResponse = { return message; }, - fromPartial(object: DeepPartial): QueryAllBalancesResponse { - const message = { ...baseQueryAllBalancesResponse } as QueryAllBalancesResponse; - message.balances = []; - if (object.balances !== undefined && object.balances !== null) { - for (const e of object.balances) { - message.balances.push(Coin.fromPartial(e)); - } - } - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageResponse.fromPartial(object.pagination); - } else { - message.pagination = undefined; - } - return message; - }, - toJSON(message: QueryAllBalancesResponse): unknown { const obj: any = {}; if (message.balances) { @@ -348,6 +338,22 @@ export const QueryAllBalancesResponse = { (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); return obj; }, + + fromPartial(object: DeepPartial): QueryAllBalancesResponse { + const message = { ...baseQueryAllBalancesResponse } as QueryAllBalancesResponse; + message.balances = []; + if (object.balances !== undefined && object.balances !== null) { + for (const e of object.balances) { + message.balances.push(Coin.fromPartial(e)); + } + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromPartial(object.pagination); + } else { + message.pagination = undefined; + } + return message; + }, }; const baseQueryTotalSupplyRequest: object = {}; @@ -360,7 +366,7 @@ export const QueryTotalSupplyRequest = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryTotalSupplyRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryTotalSupplyRequest) as QueryTotalSupplyRequest; + const message = { ...baseQueryTotalSupplyRequest } as QueryTotalSupplyRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -373,11 +379,6 @@ export const QueryTotalSupplyRequest = { }, fromJSON(_: any): QueryTotalSupplyRequest { - const message = Object.create(baseQueryTotalSupplyRequest) as QueryTotalSupplyRequest; - return message; - }, - - fromPartial(_: DeepPartial): QueryTotalSupplyRequest { const message = { ...baseQueryTotalSupplyRequest } as QueryTotalSupplyRequest; return message; }, @@ -386,6 +387,11 @@ export const QueryTotalSupplyRequest = { const obj: any = {}; return obj; }, + + fromPartial(_: DeepPartial): QueryTotalSupplyRequest { + const message = { ...baseQueryTotalSupplyRequest } as QueryTotalSupplyRequest; + return message; + }, }; const baseQueryTotalSupplyResponse: object = {}; @@ -401,7 +407,7 @@ export const QueryTotalSupplyResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryTotalSupplyResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryTotalSupplyResponse) as QueryTotalSupplyResponse; + const message = { ...baseQueryTotalSupplyResponse } as QueryTotalSupplyResponse; message.supply = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -418,22 +424,11 @@ export const QueryTotalSupplyResponse = { }, fromJSON(object: any): QueryTotalSupplyResponse { - const message = Object.create(baseQueryTotalSupplyResponse) as QueryTotalSupplyResponse; - message.supply = []; - if (object.supply !== undefined && object.supply !== null) { - for (const e of object.supply) { - message.supply.push(Coin.fromJSON(e)); - } - } - return message; - }, - - fromPartial(object: DeepPartial): QueryTotalSupplyResponse { const message = { ...baseQueryTotalSupplyResponse } as QueryTotalSupplyResponse; message.supply = []; if (object.supply !== undefined && object.supply !== null) { for (const e of object.supply) { - message.supply.push(Coin.fromPartial(e)); + message.supply.push(Coin.fromJSON(e)); } } return message; @@ -448,20 +443,33 @@ export const QueryTotalSupplyResponse = { } return obj; }, + + fromPartial(object: DeepPartial): QueryTotalSupplyResponse { + const message = { ...baseQueryTotalSupplyResponse } as QueryTotalSupplyResponse; + message.supply = []; + if (object.supply !== undefined && object.supply !== null) { + for (const e of object.supply) { + message.supply.push(Coin.fromPartial(e)); + } + } + return message; + }, }; const baseQuerySupplyOfRequest: object = { denom: "" }; export const QuerySupplyOfRequest = { encode(message: QuerySupplyOfRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.denom); + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): QuerySupplyOfRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQuerySupplyOfRequest) as QuerySupplyOfRequest; + const message = { ...baseQuerySupplyOfRequest } as QuerySupplyOfRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -477,19 +485,9 @@ export const QuerySupplyOfRequest = { }, fromJSON(object: any): QuerySupplyOfRequest { - const message = Object.create(baseQuerySupplyOfRequest) as QuerySupplyOfRequest; - if (object.denom !== undefined && object.denom !== null) { - message.denom = String(object.denom); - } else { - message.denom = ""; - } - return message; - }, - - fromPartial(object: DeepPartial): QuerySupplyOfRequest { const message = { ...baseQuerySupplyOfRequest } as QuerySupplyOfRequest; if (object.denom !== undefined && object.denom !== null) { - message.denom = object.denom; + message.denom = String(object.denom); } else { message.denom = ""; } @@ -501,6 +499,16 @@ export const QuerySupplyOfRequest = { message.denom !== undefined && (obj.denom = message.denom); return obj; }, + + fromPartial(object: DeepPartial): QuerySupplyOfRequest { + const message = { ...baseQuerySupplyOfRequest } as QuerySupplyOfRequest; + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } else { + message.denom = ""; + } + return message; + }, }; const baseQuerySupplyOfResponse: object = {}; @@ -516,7 +524,7 @@ export const QuerySupplyOfResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): QuerySupplyOfResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQuerySupplyOfResponse) as QuerySupplyOfResponse; + const message = { ...baseQuerySupplyOfResponse } as QuerySupplyOfResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -532,19 +540,9 @@ export const QuerySupplyOfResponse = { }, fromJSON(object: any): QuerySupplyOfResponse { - const message = Object.create(baseQuerySupplyOfResponse) as QuerySupplyOfResponse; - if (object.amount !== undefined && object.amount !== null) { - message.amount = Coin.fromJSON(object.amount); - } else { - message.amount = undefined; - } - return message; - }, - - fromPartial(object: DeepPartial): QuerySupplyOfResponse { const message = { ...baseQuerySupplyOfResponse } as QuerySupplyOfResponse; if (object.amount !== undefined && object.amount !== null) { - message.amount = Coin.fromPartial(object.amount); + message.amount = Coin.fromJSON(object.amount); } else { message.amount = undefined; } @@ -556,6 +554,16 @@ export const QuerySupplyOfResponse = { message.amount !== undefined && (obj.amount = message.amount ? Coin.toJSON(message.amount) : undefined); return obj; }, + + fromPartial(object: DeepPartial): QuerySupplyOfResponse { + const message = { ...baseQuerySupplyOfResponse } as QuerySupplyOfResponse; + if (object.amount !== undefined && object.amount !== null) { + message.amount = Coin.fromPartial(object.amount); + } else { + message.amount = undefined; + } + return message; + }, }; const baseQueryParamsRequest: object = {}; @@ -568,7 +576,7 @@ export const QueryParamsRequest = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryParamsRequest) as QueryParamsRequest; + const message = { ...baseQueryParamsRequest } as QueryParamsRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -581,11 +589,6 @@ export const QueryParamsRequest = { }, fromJSON(_: any): QueryParamsRequest { - const message = Object.create(baseQueryParamsRequest) as QueryParamsRequest; - return message; - }, - - fromPartial(_: DeepPartial): QueryParamsRequest { const message = { ...baseQueryParamsRequest } as QueryParamsRequest; return message; }, @@ -594,6 +597,11 @@ export const QueryParamsRequest = { const obj: any = {}; return obj; }, + + fromPartial(_: DeepPartial): QueryParamsRequest { + const message = { ...baseQueryParamsRequest } as QueryParamsRequest; + return message; + }, }; const baseQueryParamsResponse: object = {}; @@ -609,7 +617,7 @@ export const QueryParamsResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryParamsResponse) as QueryParamsResponse; + const message = { ...baseQueryParamsResponse } as QueryParamsResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -625,19 +633,9 @@ export const QueryParamsResponse = { }, fromJSON(object: any): QueryParamsResponse { - const message = Object.create(baseQueryParamsResponse) as QueryParamsResponse; - if (object.params !== undefined && object.params !== null) { - message.params = Params.fromJSON(object.params); - } else { - message.params = undefined; - } - return message; - }, - - fromPartial(object: DeepPartial): QueryParamsResponse { const message = { ...baseQueryParamsResponse } as QueryParamsResponse; if (object.params !== undefined && object.params !== null) { - message.params = Params.fromPartial(object.params); + message.params = Params.fromJSON(object.params); } else { message.params = undefined; } @@ -649,6 +647,16 @@ export const QueryParamsResponse = { message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); 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; + } + return message; + }, }; /** Query defines the gRPC querier service. */ diff --git a/packages/stargate/src/codec/cosmos/bank/v1beta1/tx.ts b/packages/stargate/src/codec/cosmos/bank/v1beta1/tx.ts index f13c2a76..5aeee5b9 100644 --- a/packages/stargate/src/codec/cosmos/bank/v1beta1/tx.ts +++ b/packages/stargate/src/codec/cosmos/bank/v1beta1/tx.ts @@ -29,8 +29,12 @@ const baseMsgSend: object = { fromAddress: "", toAddress: "" }; export const MsgSend = { encode(message: MsgSend, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.fromAddress); - writer.uint32(18).string(message.toAddress); + if (message.fromAddress !== "") { + writer.uint32(10).string(message.fromAddress); + } + if (message.toAddress !== "") { + writer.uint32(18).string(message.toAddress); + } for (const v of message.amount) { Coin.encode(v!, writer.uint32(26).fork()).ldelim(); } @@ -40,7 +44,7 @@ export const MsgSend = { decode(input: _m0.Reader | Uint8Array, length?: number): MsgSend { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseMsgSend) as MsgSend; + const message = { ...baseMsgSend } as MsgSend; message.amount = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -63,7 +67,7 @@ export const MsgSend = { }, fromJSON(object: any): MsgSend { - const message = Object.create(baseMsgSend) as MsgSend; + const message = { ...baseMsgSend } as MsgSend; message.amount = []; if (object.fromAddress !== undefined && object.fromAddress !== null) { message.fromAddress = String(object.fromAddress); @@ -83,6 +87,18 @@ export const MsgSend = { return message; }, + toJSON(message: MsgSend): unknown { + const obj: any = {}; + message.fromAddress !== undefined && (obj.fromAddress = message.fromAddress); + message.toAddress !== undefined && (obj.toAddress = message.toAddress); + if (message.amount) { + obj.amount = message.amount.map((e) => (e ? Coin.toJSON(e) : undefined)); + } else { + obj.amount = []; + } + return obj; + }, + fromPartial(object: DeepPartial): MsgSend { const message = { ...baseMsgSend } as MsgSend; message.amount = []; @@ -103,18 +119,6 @@ export const MsgSend = { } return message; }, - - toJSON(message: MsgSend): unknown { - const obj: any = {}; - message.fromAddress !== undefined && (obj.fromAddress = message.fromAddress); - message.toAddress !== undefined && (obj.toAddress = message.toAddress); - if (message.amount) { - obj.amount = message.amount.map((e) => (e ? Coin.toJSON(e) : undefined)); - } else { - obj.amount = []; - } - return obj; - }, }; const baseMsgSendResponse: object = {}; @@ -127,7 +131,7 @@ export const MsgSendResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): MsgSendResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseMsgSendResponse) as MsgSendResponse; + const message = { ...baseMsgSendResponse } as MsgSendResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -140,11 +144,6 @@ export const MsgSendResponse = { }, fromJSON(_: any): MsgSendResponse { - const message = Object.create(baseMsgSendResponse) as MsgSendResponse; - return message; - }, - - fromPartial(_: DeepPartial): MsgSendResponse { const message = { ...baseMsgSendResponse } as MsgSendResponse; return message; }, @@ -153,6 +152,11 @@ export const MsgSendResponse = { const obj: any = {}; return obj; }, + + fromPartial(_: DeepPartial): MsgSendResponse { + const message = { ...baseMsgSendResponse } as MsgSendResponse; + return message; + }, }; const baseMsgMultiSend: object = {}; @@ -171,7 +175,7 @@ export const MsgMultiSend = { decode(input: _m0.Reader | Uint8Array, length?: number): MsgMultiSend { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseMsgMultiSend) as MsgMultiSend; + const message = { ...baseMsgMultiSend } as MsgMultiSend; message.inputs = []; message.outputs = []; while (reader.pos < end) { @@ -192,7 +196,7 @@ export const MsgMultiSend = { }, fromJSON(object: any): MsgMultiSend { - const message = Object.create(baseMsgMultiSend) as MsgMultiSend; + const message = { ...baseMsgMultiSend } as MsgMultiSend; message.inputs = []; message.outputs = []; if (object.inputs !== undefined && object.inputs !== null) { @@ -208,23 +212,6 @@ export const MsgMultiSend = { return message; }, - fromPartial(object: DeepPartial): MsgMultiSend { - const message = { ...baseMsgMultiSend } as MsgMultiSend; - message.inputs = []; - message.outputs = []; - if (object.inputs !== undefined && object.inputs !== null) { - for (const e of object.inputs) { - message.inputs.push(Input.fromPartial(e)); - } - } - if (object.outputs !== undefined && object.outputs !== null) { - for (const e of object.outputs) { - message.outputs.push(Output.fromPartial(e)); - } - } - return message; - }, - toJSON(message: MsgMultiSend): unknown { const obj: any = {}; if (message.inputs) { @@ -239,6 +226,23 @@ export const MsgMultiSend = { } return obj; }, + + fromPartial(object: DeepPartial): MsgMultiSend { + const message = { ...baseMsgMultiSend } as MsgMultiSend; + message.inputs = []; + message.outputs = []; + if (object.inputs !== undefined && object.inputs !== null) { + for (const e of object.inputs) { + message.inputs.push(Input.fromPartial(e)); + } + } + if (object.outputs !== undefined && object.outputs !== null) { + for (const e of object.outputs) { + message.outputs.push(Output.fromPartial(e)); + } + } + return message; + }, }; const baseMsgMultiSendResponse: object = {}; @@ -251,7 +255,7 @@ export const MsgMultiSendResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): MsgMultiSendResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseMsgMultiSendResponse) as MsgMultiSendResponse; + const message = { ...baseMsgMultiSendResponse } as MsgMultiSendResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -264,11 +268,6 @@ export const MsgMultiSendResponse = { }, fromJSON(_: any): MsgMultiSendResponse { - const message = Object.create(baseMsgMultiSendResponse) as MsgMultiSendResponse; - return message; - }, - - fromPartial(_: DeepPartial): MsgMultiSendResponse { const message = { ...baseMsgMultiSendResponse } as MsgMultiSendResponse; return message; }, @@ -277,6 +276,11 @@ export const MsgMultiSendResponse = { const obj: any = {}; return obj; }, + + fromPartial(_: DeepPartial): MsgMultiSendResponse { + const message = { ...baseMsgMultiSendResponse } as MsgMultiSendResponse; + return message; + }, }; /** Msg defines the bank Msg service. */ diff --git a/packages/stargate/src/codec/cosmos/base/abci/v1beta1/abci.ts b/packages/stargate/src/codec/cosmos/base/abci/v1beta1/abci.ts index 83e3517c..2feb981f 100644 --- a/packages/stargate/src/codec/cosmos/base/abci/v1beta1/abci.ts +++ b/packages/stargate/src/codec/cosmos/base/abci/v1beta1/abci.ts @@ -154,29 +154,49 @@ const baseTxResponse: object = { export const TxResponse = { encode(message: TxResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).int64(message.height); - writer.uint32(18).string(message.txhash); - writer.uint32(26).string(message.codespace); - writer.uint32(32).uint32(message.code); - writer.uint32(42).string(message.data); - writer.uint32(50).string(message.rawLog); + if (!message.height.isZero()) { + writer.uint32(8).int64(message.height); + } + if (message.txhash !== "") { + writer.uint32(18).string(message.txhash); + } + if (message.codespace !== "") { + writer.uint32(26).string(message.codespace); + } + if (message.code !== 0) { + writer.uint32(32).uint32(message.code); + } + if (message.data !== "") { + writer.uint32(42).string(message.data); + } + if (message.rawLog !== "") { + writer.uint32(50).string(message.rawLog); + } for (const v of message.logs) { ABCIMessageLog.encode(v!, writer.uint32(58).fork()).ldelim(); } - writer.uint32(66).string(message.info); - writer.uint32(72).int64(message.gasWanted); - writer.uint32(80).int64(message.gasUsed); + if (message.info !== "") { + writer.uint32(66).string(message.info); + } + if (!message.gasWanted.isZero()) { + writer.uint32(72).int64(message.gasWanted); + } + if (!message.gasUsed.isZero()) { + writer.uint32(80).int64(message.gasUsed); + } if (message.tx !== undefined) { Any.encode(message.tx, writer.uint32(90).fork()).ldelim(); } - writer.uint32(98).string(message.timestamp); + if (message.timestamp !== "") { + writer.uint32(98).string(message.timestamp); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): TxResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseTxResponse) as TxResponse; + const message = { ...baseTxResponse } as TxResponse; message.logs = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -226,7 +246,7 @@ export const TxResponse = { }, fromJSON(object: any): TxResponse { - const message = Object.create(baseTxResponse) as TxResponse; + const message = { ...baseTxResponse } as TxResponse; message.logs = []; if (object.height !== undefined && object.height !== null) { message.height = Long.fromString(object.height); @@ -291,6 +311,27 @@ export const TxResponse = { return message; }, + toJSON(message: TxResponse): unknown { + const obj: any = {}; + message.height !== undefined && (obj.height = (message.height || Long.ZERO).toString()); + message.txhash !== undefined && (obj.txhash = message.txhash); + message.codespace !== undefined && (obj.codespace = message.codespace); + message.code !== undefined && (obj.code = message.code); + message.data !== undefined && (obj.data = message.data); + message.rawLog !== undefined && (obj.rawLog = message.rawLog); + if (message.logs) { + obj.logs = message.logs.map((e) => (e ? ABCIMessageLog.toJSON(e) : undefined)); + } else { + obj.logs = []; + } + message.info !== undefined && (obj.info = message.info); + message.gasWanted !== undefined && (obj.gasWanted = (message.gasWanted || Long.ZERO).toString()); + message.gasUsed !== undefined && (obj.gasUsed = (message.gasUsed || Long.ZERO).toString()); + message.tx !== undefined && (obj.tx = message.tx ? Any.toJSON(message.tx) : undefined); + message.timestamp !== undefined && (obj.timestamp = message.timestamp); + return obj; + }, + fromPartial(object: DeepPartial): TxResponse { const message = { ...baseTxResponse } as TxResponse; message.logs = []; @@ -356,35 +397,18 @@ export const TxResponse = { } return message; }, - - toJSON(message: TxResponse): unknown { - const obj: any = {}; - message.height !== undefined && (obj.height = (message.height || Long.ZERO).toString()); - message.txhash !== undefined && (obj.txhash = message.txhash); - message.codespace !== undefined && (obj.codespace = message.codespace); - message.code !== undefined && (obj.code = message.code); - message.data !== undefined && (obj.data = message.data); - message.rawLog !== undefined && (obj.rawLog = message.rawLog); - if (message.logs) { - obj.logs = message.logs.map((e) => (e ? ABCIMessageLog.toJSON(e) : undefined)); - } else { - obj.logs = []; - } - message.info !== undefined && (obj.info = message.info); - message.gasWanted !== undefined && (obj.gasWanted = (message.gasWanted || Long.ZERO).toString()); - message.gasUsed !== undefined && (obj.gasUsed = (message.gasUsed || Long.ZERO).toString()); - message.tx !== undefined && (obj.tx = message.tx ? Any.toJSON(message.tx) : undefined); - message.timestamp !== undefined && (obj.timestamp = message.timestamp); - return obj; - }, }; const baseABCIMessageLog: object = { msgIndex: 0, log: "" }; export const ABCIMessageLog = { encode(message: ABCIMessageLog, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).uint32(message.msgIndex); - writer.uint32(18).string(message.log); + if (message.msgIndex !== 0) { + writer.uint32(8).uint32(message.msgIndex); + } + if (message.log !== "") { + writer.uint32(18).string(message.log); + } for (const v of message.events) { StringEvent.encode(v!, writer.uint32(26).fork()).ldelim(); } @@ -394,7 +418,7 @@ export const ABCIMessageLog = { decode(input: _m0.Reader | Uint8Array, length?: number): ABCIMessageLog { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseABCIMessageLog) as ABCIMessageLog; + const message = { ...baseABCIMessageLog } as ABCIMessageLog; message.events = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -417,7 +441,7 @@ export const ABCIMessageLog = { }, fromJSON(object: any): ABCIMessageLog { - const message = Object.create(baseABCIMessageLog) as ABCIMessageLog; + const message = { ...baseABCIMessageLog } as ABCIMessageLog; message.events = []; if (object.msgIndex !== undefined && object.msgIndex !== null) { message.msgIndex = Number(object.msgIndex); @@ -437,6 +461,18 @@ export const ABCIMessageLog = { return message; }, + toJSON(message: ABCIMessageLog): unknown { + const obj: any = {}; + message.msgIndex !== undefined && (obj.msgIndex = message.msgIndex); + message.log !== undefined && (obj.log = message.log); + if (message.events) { + obj.events = message.events.map((e) => (e ? StringEvent.toJSON(e) : undefined)); + } else { + obj.events = []; + } + return obj; + }, + fromPartial(object: DeepPartial): ABCIMessageLog { const message = { ...baseABCIMessageLog } as ABCIMessageLog; message.events = []; @@ -457,25 +493,15 @@ export const ABCIMessageLog = { } return message; }, - - toJSON(message: ABCIMessageLog): unknown { - const obj: any = {}; - message.msgIndex !== undefined && (obj.msgIndex = message.msgIndex); - message.log !== undefined && (obj.log = message.log); - if (message.events) { - obj.events = message.events.map((e) => (e ? StringEvent.toJSON(e) : undefined)); - } else { - obj.events = []; - } - return obj; - }, }; const baseStringEvent: object = { type: "" }; export const StringEvent = { encode(message: StringEvent, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.type); + if (message.type !== "") { + writer.uint32(10).string(message.type); + } for (const v of message.attributes) { Attribute.encode(v!, writer.uint32(18).fork()).ldelim(); } @@ -485,7 +511,7 @@ export const StringEvent = { decode(input: _m0.Reader | Uint8Array, length?: number): StringEvent { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseStringEvent) as StringEvent; + const message = { ...baseStringEvent } as StringEvent; message.attributes = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -505,7 +531,7 @@ export const StringEvent = { }, fromJSON(object: any): StringEvent { - const message = Object.create(baseStringEvent) as StringEvent; + const message = { ...baseStringEvent } as StringEvent; message.attributes = []; if (object.type !== undefined && object.type !== null) { message.type = String(object.type); @@ -520,6 +546,17 @@ export const StringEvent = { return message; }, + toJSON(message: StringEvent): unknown { + const obj: any = {}; + message.type !== undefined && (obj.type = message.type); + if (message.attributes) { + obj.attributes = message.attributes.map((e) => (e ? Attribute.toJSON(e) : undefined)); + } else { + obj.attributes = []; + } + return obj; + }, + fromPartial(object: DeepPartial): StringEvent { const message = { ...baseStringEvent } as StringEvent; message.attributes = []; @@ -535,32 +572,25 @@ export const StringEvent = { } return message; }, - - toJSON(message: StringEvent): unknown { - const obj: any = {}; - message.type !== undefined && (obj.type = message.type); - if (message.attributes) { - obj.attributes = message.attributes.map((e) => (e ? Attribute.toJSON(e) : undefined)); - } else { - obj.attributes = []; - } - return obj; - }, }; const baseAttribute: object = { key: "", value: "" }; export const Attribute = { encode(message: Attribute, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.key); - writer.uint32(18).string(message.value); + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): Attribute { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseAttribute) as Attribute; + const message = { ...baseAttribute } as Attribute; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -579,7 +609,7 @@ export const Attribute = { }, fromJSON(object: any): Attribute { - const message = Object.create(baseAttribute) as Attribute; + const message = { ...baseAttribute } as Attribute; if (object.key !== undefined && object.key !== null) { message.key = String(object.key); } else { @@ -593,6 +623,13 @@ export const Attribute = { return message; }, + toJSON(message: Attribute): unknown { + const obj: any = {}; + message.key !== undefined && (obj.key = message.key); + message.value !== undefined && (obj.value = message.value); + return obj; + }, + fromPartial(object: DeepPartial): Attribute { const message = { ...baseAttribute } as Attribute; if (object.key !== undefined && object.key !== null) { @@ -607,28 +644,25 @@ export const Attribute = { } return message; }, - - toJSON(message: Attribute): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = message.key); - message.value !== undefined && (obj.value = message.value); - return obj; - }, }; const baseGasInfo: object = { gasWanted: Long.UZERO, gasUsed: Long.UZERO }; export const GasInfo = { encode(message: GasInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).uint64(message.gasWanted); - writer.uint32(16).uint64(message.gasUsed); + if (!message.gasWanted.isZero()) { + writer.uint32(8).uint64(message.gasWanted); + } + if (!message.gasUsed.isZero()) { + writer.uint32(16).uint64(message.gasUsed); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): GasInfo { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseGasInfo) as GasInfo; + const message = { ...baseGasInfo } as GasInfo; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -647,7 +681,7 @@ export const GasInfo = { }, fromJSON(object: any): GasInfo { - const message = Object.create(baseGasInfo) as GasInfo; + const message = { ...baseGasInfo } as GasInfo; if (object.gasWanted !== undefined && object.gasWanted !== null) { message.gasWanted = Long.fromString(object.gasWanted); } else { @@ -661,6 +695,13 @@ export const GasInfo = { return message; }, + toJSON(message: GasInfo): unknown { + const obj: any = {}; + message.gasWanted !== undefined && (obj.gasWanted = (message.gasWanted || Long.UZERO).toString()); + message.gasUsed !== undefined && (obj.gasUsed = (message.gasUsed || Long.UZERO).toString()); + return obj; + }, + fromPartial(object: DeepPartial): GasInfo { const message = { ...baseGasInfo } as GasInfo; if (object.gasWanted !== undefined && object.gasWanted !== null) { @@ -675,21 +716,18 @@ export const GasInfo = { } return message; }, - - toJSON(message: GasInfo): unknown { - const obj: any = {}; - message.gasWanted !== undefined && (obj.gasWanted = (message.gasWanted || Long.UZERO).toString()); - message.gasUsed !== undefined && (obj.gasUsed = (message.gasUsed || Long.UZERO).toString()); - return obj; - }, }; const baseResult: object = { log: "" }; export const Result = { encode(message: Result, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).bytes(message.data); - writer.uint32(18).string(message.log); + if (message.data.length !== 0) { + writer.uint32(10).bytes(message.data); + } + if (message.log !== "") { + writer.uint32(18).string(message.log); + } for (const v of message.events) { Event.encode(v!, writer.uint32(26).fork()).ldelim(); } @@ -699,7 +737,7 @@ export const Result = { decode(input: _m0.Reader | Uint8Array, length?: number): Result { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseResult) as Result; + const message = { ...baseResult } as Result; message.events = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -722,7 +760,7 @@ export const Result = { }, fromJSON(object: any): Result { - const message = Object.create(baseResult) as Result; + const message = { ...baseResult } as Result; message.events = []; if (object.data !== undefined && object.data !== null) { message.data = bytesFromBase64(object.data); @@ -740,6 +778,19 @@ export const Result = { return message; }, + toJSON(message: Result): unknown { + const obj: any = {}; + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); + message.log !== undefined && (obj.log = message.log); + if (message.events) { + obj.events = message.events.map((e) => (e ? Event.toJSON(e) : undefined)); + } else { + obj.events = []; + } + return obj; + }, + fromPartial(object: DeepPartial): Result { const message = { ...baseResult } as Result; message.events = []; @@ -760,19 +811,6 @@ export const Result = { } return message; }, - - toJSON(message: Result): unknown { - const obj: any = {}; - message.data !== undefined && - (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); - message.log !== undefined && (obj.log = message.log); - if (message.events) { - obj.events = message.events.map((e) => (e ? Event.toJSON(e) : undefined)); - } else { - obj.events = []; - } - return obj; - }, }; const baseSimulationResponse: object = {}; @@ -791,7 +829,7 @@ export const SimulationResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): SimulationResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseSimulationResponse) as SimulationResponse; + const message = { ...baseSimulationResponse } as SimulationResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -810,7 +848,7 @@ export const SimulationResponse = { }, fromJSON(object: any): SimulationResponse { - const message = Object.create(baseSimulationResponse) as SimulationResponse; + const message = { ...baseSimulationResponse } as SimulationResponse; if (object.gasInfo !== undefined && object.gasInfo !== null) { message.gasInfo = GasInfo.fromJSON(object.gasInfo); } else { @@ -824,6 +862,14 @@ export const SimulationResponse = { return message; }, + toJSON(message: SimulationResponse): unknown { + const obj: any = {}; + message.gasInfo !== undefined && + (obj.gasInfo = message.gasInfo ? GasInfo.toJSON(message.gasInfo) : undefined); + message.result !== undefined && (obj.result = message.result ? Result.toJSON(message.result) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): SimulationResponse { const message = { ...baseSimulationResponse } as SimulationResponse; if (object.gasInfo !== undefined && object.gasInfo !== null) { @@ -838,29 +884,25 @@ export const SimulationResponse = { } return message; }, - - toJSON(message: SimulationResponse): unknown { - const obj: any = {}; - message.gasInfo !== undefined && - (obj.gasInfo = message.gasInfo ? GasInfo.toJSON(message.gasInfo) : undefined); - message.result !== undefined && (obj.result = message.result ? Result.toJSON(message.result) : undefined); - return obj; - }, }; const baseMsgData: object = { msgType: "" }; export const MsgData = { encode(message: MsgData, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.msgType); - writer.uint32(18).bytes(message.data); + if (message.msgType !== "") { + writer.uint32(10).string(message.msgType); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgData { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseMsgData) as MsgData; + const message = { ...baseMsgData } as MsgData; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -879,7 +921,7 @@ export const MsgData = { }, fromJSON(object: any): MsgData { - const message = Object.create(baseMsgData) as MsgData; + const message = { ...baseMsgData } as MsgData; if (object.msgType !== undefined && object.msgType !== null) { message.msgType = String(object.msgType); } else { @@ -891,6 +933,14 @@ export const MsgData = { return message; }, + toJSON(message: MsgData): unknown { + const obj: any = {}; + message.msgType !== undefined && (obj.msgType = message.msgType); + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); + return obj; + }, + fromPartial(object: DeepPartial): MsgData { const message = { ...baseMsgData } as MsgData; if (object.msgType !== undefined && object.msgType !== null) { @@ -905,14 +955,6 @@ export const MsgData = { } return message; }, - - toJSON(message: MsgData): unknown { - const obj: any = {}; - message.msgType !== undefined && (obj.msgType = message.msgType); - message.data !== undefined && - (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); - return obj; - }, }; const baseTxMsgData: object = {}; @@ -928,7 +970,7 @@ export const TxMsgData = { decode(input: _m0.Reader | Uint8Array, length?: number): TxMsgData { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseTxMsgData) as TxMsgData; + const message = { ...baseTxMsgData } as TxMsgData; message.data = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -945,22 +987,11 @@ export const TxMsgData = { }, fromJSON(object: any): TxMsgData { - const message = Object.create(baseTxMsgData) as TxMsgData; - message.data = []; - if (object.data !== undefined && object.data !== null) { - for (const e of object.data) { - message.data.push(MsgData.fromJSON(e)); - } - } - return message; - }, - - fromPartial(object: DeepPartial): TxMsgData { const message = { ...baseTxMsgData } as TxMsgData; message.data = []; if (object.data !== undefined && object.data !== null) { for (const e of object.data) { - message.data.push(MsgData.fromPartial(e)); + message.data.push(MsgData.fromJSON(e)); } } return message; @@ -975,6 +1006,17 @@ export const TxMsgData = { } return obj; }, + + fromPartial(object: DeepPartial): TxMsgData { + const message = { ...baseTxMsgData } as TxMsgData; + message.data = []; + if (object.data !== undefined && object.data !== null) { + for (const e of object.data) { + message.data.push(MsgData.fromPartial(e)); + } + } + return message; + }, }; const baseSearchTxsResult: object = { @@ -987,11 +1029,21 @@ const baseSearchTxsResult: object = { export const SearchTxsResult = { encode(message: SearchTxsResult, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).uint64(message.totalCount); - writer.uint32(16).uint64(message.count); - writer.uint32(24).uint64(message.pageNumber); - writer.uint32(32).uint64(message.pageTotal); - writer.uint32(40).uint64(message.limit); + if (!message.totalCount.isZero()) { + writer.uint32(8).uint64(message.totalCount); + } + if (!message.count.isZero()) { + writer.uint32(16).uint64(message.count); + } + if (!message.pageNumber.isZero()) { + writer.uint32(24).uint64(message.pageNumber); + } + if (!message.pageTotal.isZero()) { + writer.uint32(32).uint64(message.pageTotal); + } + if (!message.limit.isZero()) { + writer.uint32(40).uint64(message.limit); + } for (const v of message.txs) { TxResponse.encode(v!, writer.uint32(50).fork()).ldelim(); } @@ -1001,7 +1053,7 @@ export const SearchTxsResult = { decode(input: _m0.Reader | Uint8Array, length?: number): SearchTxsResult { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseSearchTxsResult) as SearchTxsResult; + const message = { ...baseSearchTxsResult } as SearchTxsResult; message.txs = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -1033,7 +1085,7 @@ export const SearchTxsResult = { }, fromJSON(object: any): SearchTxsResult { - const message = Object.create(baseSearchTxsResult) as SearchTxsResult; + const message = { ...baseSearchTxsResult } as SearchTxsResult; message.txs = []; if (object.totalCount !== undefined && object.totalCount !== null) { message.totalCount = Long.fromString(object.totalCount); @@ -1068,6 +1120,21 @@ export const SearchTxsResult = { return message; }, + toJSON(message: SearchTxsResult): unknown { + const obj: any = {}; + message.totalCount !== undefined && (obj.totalCount = (message.totalCount || Long.UZERO).toString()); + message.count !== undefined && (obj.count = (message.count || Long.UZERO).toString()); + message.pageNumber !== undefined && (obj.pageNumber = (message.pageNumber || Long.UZERO).toString()); + message.pageTotal !== undefined && (obj.pageTotal = (message.pageTotal || Long.UZERO).toString()); + message.limit !== undefined && (obj.limit = (message.limit || Long.UZERO).toString()); + if (message.txs) { + obj.txs = message.txs.map((e) => (e ? TxResponse.toJSON(e) : undefined)); + } else { + obj.txs = []; + } + return obj; + }, + fromPartial(object: DeepPartial): SearchTxsResult { const message = { ...baseSearchTxsResult } as SearchTxsResult; message.txs = []; @@ -1103,21 +1170,6 @@ export const SearchTxsResult = { } return message; }, - - toJSON(message: SearchTxsResult): unknown { - const obj: any = {}; - message.totalCount !== undefined && (obj.totalCount = (message.totalCount || Long.UZERO).toString()); - message.count !== undefined && (obj.count = (message.count || Long.UZERO).toString()); - message.pageNumber !== undefined && (obj.pageNumber = (message.pageNumber || Long.UZERO).toString()); - message.pageTotal !== undefined && (obj.pageTotal = (message.pageTotal || Long.UZERO).toString()); - message.limit !== undefined && (obj.limit = (message.limit || Long.UZERO).toString()); - if (message.txs) { - obj.txs = message.txs.map((e) => (e ? TxResponse.toJSON(e) : undefined)); - } else { - obj.txs = []; - } - return obj; - }, }; declare var self: any | undefined; @@ -1127,7 +1179,7 @@ var globalThis: any = (() => { if (typeof self !== "undefined") return self; if (typeof window !== "undefined") return window; if (typeof global !== "undefined") return global; - throw new Error("Unable to locate global object"); + throw "Unable to locate global object"; })(); const atob: (b64: string) => string = diff --git a/packages/stargate/src/codec/cosmos/base/query/v1beta1/pagination.ts b/packages/stargate/src/codec/cosmos/base/query/v1beta1/pagination.ts index 8dca3c76..45715b50 100644 --- a/packages/stargate/src/codec/cosmos/base/query/v1beta1/pagination.ts +++ b/packages/stargate/src/codec/cosmos/base/query/v1beta1/pagination.ts @@ -66,17 +66,25 @@ const basePageRequest: object = { offset: Long.UZERO, limit: Long.UZERO, countTo export const PageRequest = { encode(message: PageRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).bytes(message.key); - writer.uint32(16).uint64(message.offset); - writer.uint32(24).uint64(message.limit); - writer.uint32(32).bool(message.countTotal); + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (!message.offset.isZero()) { + writer.uint32(16).uint64(message.offset); + } + if (!message.limit.isZero()) { + writer.uint32(24).uint64(message.limit); + } + if (message.countTotal === true) { + writer.uint32(32).bool(message.countTotal); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): PageRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(basePageRequest) as PageRequest; + const message = { ...basePageRequest } as PageRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -101,7 +109,7 @@ export const PageRequest = { }, fromJSON(object: any): PageRequest { - const message = Object.create(basePageRequest) as PageRequest; + const message = { ...basePageRequest } as PageRequest; if (object.key !== undefined && object.key !== null) { message.key = bytesFromBase64(object.key); } @@ -123,6 +131,16 @@ export const PageRequest = { return message; }, + toJSON(message: PageRequest): unknown { + const obj: any = {}; + message.key !== undefined && + (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); + 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); + return obj; + }, + fromPartial(object: DeepPartial): PageRequest { const message = { ...basePageRequest } as PageRequest; if (object.key !== undefined && object.key !== null) { @@ -147,31 +165,25 @@ export const PageRequest = { } return message; }, - - toJSON(message: PageRequest): unknown { - const obj: any = {}; - message.key !== undefined && - (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); - 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); - return obj; - }, }; const basePageResponse: object = { total: Long.UZERO }; export const PageResponse = { encode(message: PageResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).bytes(message.nextKey); - writer.uint32(16).uint64(message.total); + if (message.nextKey.length !== 0) { + writer.uint32(10).bytes(message.nextKey); + } + if (!message.total.isZero()) { + writer.uint32(16).uint64(message.total); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): PageResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(basePageResponse) as PageResponse; + const message = { ...basePageResponse } as PageResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -190,7 +202,7 @@ export const PageResponse = { }, fromJSON(object: any): PageResponse { - const message = Object.create(basePageResponse) as PageResponse; + const message = { ...basePageResponse } as PageResponse; if (object.nextKey !== undefined && object.nextKey !== null) { message.nextKey = bytesFromBase64(object.nextKey); } @@ -202,6 +214,14 @@ export const PageResponse = { return message; }, + toJSON(message: PageResponse): unknown { + const obj: any = {}; + message.nextKey !== undefined && + (obj.nextKey = base64FromBytes(message.nextKey !== undefined ? message.nextKey : new Uint8Array())); + message.total !== undefined && (obj.total = (message.total || Long.UZERO).toString()); + return obj; + }, + fromPartial(object: DeepPartial): PageResponse { const message = { ...basePageResponse } as PageResponse; if (object.nextKey !== undefined && object.nextKey !== null) { @@ -216,14 +236,6 @@ export const PageResponse = { } return message; }, - - toJSON(message: PageResponse): unknown { - const obj: any = {}; - message.nextKey !== undefined && - (obj.nextKey = base64FromBytes(message.nextKey !== undefined ? message.nextKey : new Uint8Array())); - message.total !== undefined && (obj.total = (message.total || Long.UZERO).toString()); - return obj; - }, }; declare var self: any | undefined; @@ -233,7 +245,7 @@ var globalThis: any = (() => { if (typeof self !== "undefined") return self; if (typeof window !== "undefined") return window; if (typeof global !== "undefined") return global; - throw new Error("Unable to locate global object"); + throw "Unable to locate global object"; })(); const atob: (b64: string) => string = diff --git a/packages/stargate/src/codec/cosmos/base/v1beta1/coin.ts b/packages/stargate/src/codec/cosmos/base/v1beta1/coin.ts index 87506a94..e682a9a7 100644 --- a/packages/stargate/src/codec/cosmos/base/v1beta1/coin.ts +++ b/packages/stargate/src/codec/cosmos/base/v1beta1/coin.ts @@ -40,15 +40,19 @@ const baseCoin: object = { denom: "", amount: "" }; export const Coin = { encode(message: Coin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.denom); - writer.uint32(18).string(message.amount); + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): Coin { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseCoin) as Coin; + const message = { ...baseCoin } as Coin; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -67,7 +71,7 @@ export const Coin = { }, fromJSON(object: any): Coin { - const message = Object.create(baseCoin) as Coin; + const message = { ...baseCoin } as Coin; if (object.denom !== undefined && object.denom !== null) { message.denom = String(object.denom); } else { @@ -81,6 +85,13 @@ export const Coin = { return message; }, + toJSON(message: Coin): unknown { + const obj: any = {}; + message.denom !== undefined && (obj.denom = message.denom); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + fromPartial(object: DeepPartial): Coin { const message = { ...baseCoin } as Coin; if (object.denom !== undefined && object.denom !== null) { @@ -95,28 +106,25 @@ export const Coin = { } return message; }, - - toJSON(message: Coin): unknown { - const obj: any = {}; - message.denom !== undefined && (obj.denom = message.denom); - message.amount !== undefined && (obj.amount = message.amount); - return obj; - }, }; const baseDecCoin: object = { denom: "", amount: "" }; export const DecCoin = { encode(message: DecCoin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.denom); - writer.uint32(18).string(message.amount); + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): DecCoin { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseDecCoin) as DecCoin; + const message = { ...baseDecCoin } as DecCoin; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -135,7 +143,7 @@ export const DecCoin = { }, fromJSON(object: any): DecCoin { - const message = Object.create(baseDecCoin) as DecCoin; + const message = { ...baseDecCoin } as DecCoin; if (object.denom !== undefined && object.denom !== null) { message.denom = String(object.denom); } else { @@ -149,6 +157,13 @@ export const DecCoin = { return message; }, + toJSON(message: DecCoin): unknown { + const obj: any = {}; + message.denom !== undefined && (obj.denom = message.denom); + message.amount !== undefined && (obj.amount = message.amount); + return obj; + }, + fromPartial(object: DeepPartial): DecCoin { const message = { ...baseDecCoin } as DecCoin; if (object.denom !== undefined && object.denom !== null) { @@ -163,27 +178,22 @@ export const DecCoin = { } return message; }, - - toJSON(message: DecCoin): unknown { - const obj: any = {}; - message.denom !== undefined && (obj.denom = message.denom); - message.amount !== undefined && (obj.amount = message.amount); - return obj; - }, }; const baseIntProto: object = { int: "" }; export const IntProto = { encode(message: IntProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.int); + if (message.int !== "") { + writer.uint32(10).string(message.int); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): IntProto { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseIntProto) as IntProto; + const message = { ...baseIntProto } as IntProto; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -199,19 +209,9 @@ export const IntProto = { }, fromJSON(object: any): IntProto { - const message = Object.create(baseIntProto) as IntProto; - if (object.int !== undefined && object.int !== null) { - message.int = String(object.int); - } else { - message.int = ""; - } - return message; - }, - - fromPartial(object: DeepPartial): IntProto { const message = { ...baseIntProto } as IntProto; if (object.int !== undefined && object.int !== null) { - message.int = object.int; + message.int = String(object.int); } else { message.int = ""; } @@ -223,20 +223,32 @@ export const IntProto = { message.int !== undefined && (obj.int = message.int); return obj; }, + + fromPartial(object: DeepPartial): IntProto { + const message = { ...baseIntProto } as IntProto; + if (object.int !== undefined && object.int !== null) { + message.int = object.int; + } else { + message.int = ""; + } + return message; + }, }; const baseDecProto: object = { dec: "" }; export const DecProto = { encode(message: DecProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.dec); + if (message.dec !== "") { + writer.uint32(10).string(message.dec); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): DecProto { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseDecProto) as DecProto; + const message = { ...baseDecProto } as DecProto; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -252,19 +264,9 @@ export const DecProto = { }, fromJSON(object: any): DecProto { - const message = Object.create(baseDecProto) as DecProto; - if (object.dec !== undefined && object.dec !== null) { - message.dec = String(object.dec); - } else { - message.dec = ""; - } - return message; - }, - - fromPartial(object: DeepPartial): DecProto { const message = { ...baseDecProto } as DecProto; if (object.dec !== undefined && object.dec !== null) { - message.dec = object.dec; + message.dec = String(object.dec); } else { message.dec = ""; } @@ -276,6 +278,16 @@ export const DecProto = { message.dec !== undefined && (obj.dec = message.dec); return obj; }, + + fromPartial(object: DeepPartial): DecProto { + const message = { ...baseDecProto } as DecProto; + if (object.dec !== undefined && object.dec !== null) { + message.dec = object.dec; + } else { + message.dec = ""; + } + return message; + }, }; type Builtin = Date | Function | Uint8Array | string | number | undefined | Long; diff --git a/packages/stargate/src/codec/cosmos/crypto/multisig/v1beta1/multisig.ts b/packages/stargate/src/codec/cosmos/crypto/multisig/v1beta1/multisig.ts index 5da4f9bb..11fdaf82 100644 --- a/packages/stargate/src/codec/cosmos/crypto/multisig/v1beta1/multisig.ts +++ b/packages/stargate/src/codec/cosmos/crypto/multisig/v1beta1/multisig.ts @@ -37,7 +37,7 @@ export const MultiSignature = { decode(input: _m0.Reader | Uint8Array, length?: number): MultiSignature { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseMultiSignature) as MultiSignature; + const message = { ...baseMultiSignature } as MultiSignature; message.signatures = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -54,22 +54,11 @@ export const MultiSignature = { }, fromJSON(object: any): MultiSignature { - const message = Object.create(baseMultiSignature) as MultiSignature; - message.signatures = []; - if (object.signatures !== undefined && object.signatures !== null) { - for (const e of object.signatures) { - message.signatures.push(bytesFromBase64(e)); - } - } - return message; - }, - - fromPartial(object: DeepPartial): MultiSignature { const message = { ...baseMultiSignature } as MultiSignature; message.signatures = []; if (object.signatures !== undefined && object.signatures !== null) { for (const e of object.signatures) { - message.signatures.push(e); + message.signatures.push(bytesFromBase64(e)); } } return message; @@ -84,21 +73,36 @@ export const MultiSignature = { } return obj; }, + + fromPartial(object: DeepPartial): MultiSignature { + const message = { ...baseMultiSignature } as MultiSignature; + message.signatures = []; + if (object.signatures !== undefined && object.signatures !== null) { + for (const e of object.signatures) { + message.signatures.push(e); + } + } + return message; + }, }; const baseCompactBitArray: object = { extraBitsStored: 0 }; export const CompactBitArray = { encode(message: CompactBitArray, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).uint32(message.extraBitsStored); - writer.uint32(18).bytes(message.elems); + if (message.extraBitsStored !== 0) { + writer.uint32(8).uint32(message.extraBitsStored); + } + if (message.elems.length !== 0) { + writer.uint32(18).bytes(message.elems); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): CompactBitArray { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseCompactBitArray) as CompactBitArray; + const message = { ...baseCompactBitArray } as CompactBitArray; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -117,7 +121,7 @@ export const CompactBitArray = { }, fromJSON(object: any): CompactBitArray { - const message = Object.create(baseCompactBitArray) as CompactBitArray; + const message = { ...baseCompactBitArray } as CompactBitArray; if (object.extraBitsStored !== undefined && object.extraBitsStored !== null) { message.extraBitsStored = Number(object.extraBitsStored); } else { @@ -129,6 +133,14 @@ export const CompactBitArray = { return message; }, + toJSON(message: CompactBitArray): unknown { + const obj: any = {}; + message.extraBitsStored !== undefined && (obj.extraBitsStored = message.extraBitsStored); + message.elems !== undefined && + (obj.elems = base64FromBytes(message.elems !== undefined ? message.elems : new Uint8Array())); + return obj; + }, + fromPartial(object: DeepPartial): CompactBitArray { const message = { ...baseCompactBitArray } as CompactBitArray; if (object.extraBitsStored !== undefined && object.extraBitsStored !== null) { @@ -143,14 +155,6 @@ export const CompactBitArray = { } return message; }, - - toJSON(message: CompactBitArray): unknown { - const obj: any = {}; - message.extraBitsStored !== undefined && (obj.extraBitsStored = message.extraBitsStored); - message.elems !== undefined && - (obj.elems = base64FromBytes(message.elems !== undefined ? message.elems : new Uint8Array())); - return obj; - }, }; declare var self: any | undefined; @@ -160,7 +164,7 @@ var globalThis: any = (() => { if (typeof self !== "undefined") return self; if (typeof window !== "undefined") return window; if (typeof global !== "undefined") return global; - throw new Error("Unable to locate global object"); + throw "Unable to locate global object"; })(); const atob: (b64: string) => string = diff --git a/packages/stargate/src/codec/cosmos/crypto/secp256k1/keys.ts b/packages/stargate/src/codec/cosmos/crypto/secp256k1/keys.ts index 020ec074..984a320a 100644 --- a/packages/stargate/src/codec/cosmos/crypto/secp256k1/keys.ts +++ b/packages/stargate/src/codec/cosmos/crypto/secp256k1/keys.ts @@ -24,14 +24,16 @@ const basePubKey: object = {}; export const PubKey = { encode(message: PubKey, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).bytes(message.key); + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): PubKey { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(basePubKey) as PubKey; + const message = { ...basePubKey } as PubKey; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -47,13 +49,20 @@ export const PubKey = { }, fromJSON(object: any): PubKey { - const message = Object.create(basePubKey) as PubKey; + const message = { ...basePubKey } as PubKey; if (object.key !== undefined && object.key !== null) { message.key = bytesFromBase64(object.key); } return message; }, + toJSON(message: PubKey): unknown { + const obj: any = {}; + message.key !== undefined && + (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); + return obj; + }, + fromPartial(object: DeepPartial): PubKey { const message = { ...basePubKey } as PubKey; if (object.key !== undefined && object.key !== null) { @@ -63,27 +72,22 @@ export const PubKey = { } return message; }, - - toJSON(message: PubKey): unknown { - const obj: any = {}; - message.key !== undefined && - (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); - return obj; - }, }; const basePrivKey: object = {}; export const PrivKey = { encode(message: PrivKey, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).bytes(message.key); + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): PrivKey { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(basePrivKey) as PrivKey; + const message = { ...basePrivKey } as PrivKey; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -99,13 +103,20 @@ export const PrivKey = { }, fromJSON(object: any): PrivKey { - const message = Object.create(basePrivKey) as PrivKey; + const message = { ...basePrivKey } as PrivKey; if (object.key !== undefined && object.key !== null) { message.key = bytesFromBase64(object.key); } return message; }, + toJSON(message: PrivKey): unknown { + const obj: any = {}; + message.key !== undefined && + (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); + return obj; + }, + fromPartial(object: DeepPartial): PrivKey { const message = { ...basePrivKey } as PrivKey; if (object.key !== undefined && object.key !== null) { @@ -115,13 +126,6 @@ export const PrivKey = { } return message; }, - - toJSON(message: PrivKey): unknown { - const obj: any = {}; - message.key !== undefined && - (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); - return obj; - }, }; declare var self: any | undefined; @@ -131,7 +135,7 @@ var globalThis: any = (() => { if (typeof self !== "undefined") return self; if (typeof window !== "undefined") return window; if (typeof global !== "undefined") return global; - throw new Error("Unable to locate global object"); + throw "Unable to locate global object"; })(); const atob: (b64: string) => string = diff --git a/packages/stargate/src/codec/cosmos/distribution/v1beta1/distribution.ts b/packages/stargate/src/codec/cosmos/distribution/v1beta1/distribution.ts index e4208a9b..b50ba1b5 100644 --- a/packages/stargate/src/codec/cosmos/distribution/v1beta1/distribution.ts +++ b/packages/stargate/src/codec/cosmos/distribution/v1beta1/distribution.ts @@ -135,17 +135,25 @@ const baseParams: object = { export const Params = { encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.communityTax); - writer.uint32(18).string(message.baseProposerReward); - writer.uint32(26).string(message.bonusProposerReward); - writer.uint32(32).bool(message.withdrawAddrEnabled); + if (message.communityTax !== "") { + writer.uint32(10).string(message.communityTax); + } + if (message.baseProposerReward !== "") { + writer.uint32(18).string(message.baseProposerReward); + } + if (message.bonusProposerReward !== "") { + writer.uint32(26).string(message.bonusProposerReward); + } + if (message.withdrawAddrEnabled === true) { + writer.uint32(32).bool(message.withdrawAddrEnabled); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): Params { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseParams) as Params; + const message = { ...baseParams } as Params; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -170,7 +178,7 @@ export const Params = { }, fromJSON(object: any): Params { - const message = Object.create(baseParams) as Params; + const message = { ...baseParams } as Params; if (object.communityTax !== undefined && object.communityTax !== null) { message.communityTax = String(object.communityTax); } else { @@ -194,6 +202,15 @@ export const Params = { return message; }, + toJSON(message: Params): unknown { + const obj: any = {}; + message.communityTax !== undefined && (obj.communityTax = message.communityTax); + message.baseProposerReward !== undefined && (obj.baseProposerReward = message.baseProposerReward); + message.bonusProposerReward !== undefined && (obj.bonusProposerReward = message.bonusProposerReward); + message.withdrawAddrEnabled !== undefined && (obj.withdrawAddrEnabled = message.withdrawAddrEnabled); + return obj; + }, + fromPartial(object: DeepPartial): Params { const message = { ...baseParams } as Params; if (object.communityTax !== undefined && object.communityTax !== null) { @@ -218,15 +235,6 @@ export const Params = { } return message; }, - - toJSON(message: Params): unknown { - const obj: any = {}; - message.communityTax !== undefined && (obj.communityTax = message.communityTax); - message.baseProposerReward !== undefined && (obj.baseProposerReward = message.baseProposerReward); - message.bonusProposerReward !== undefined && (obj.bonusProposerReward = message.bonusProposerReward); - message.withdrawAddrEnabled !== undefined && (obj.withdrawAddrEnabled = message.withdrawAddrEnabled); - return obj; - }, }; const baseValidatorHistoricalRewards: object = { referenceCount: 0 }; @@ -236,14 +244,16 @@ export const ValidatorHistoricalRewards = { for (const v of message.cumulativeRewardRatio) { DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); } - writer.uint32(16).uint32(message.referenceCount); + if (message.referenceCount !== 0) { + writer.uint32(16).uint32(message.referenceCount); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorHistoricalRewards { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseValidatorHistoricalRewards) as ValidatorHistoricalRewards; + const message = { ...baseValidatorHistoricalRewards } as ValidatorHistoricalRewards; message.cumulativeRewardRatio = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -263,7 +273,7 @@ export const ValidatorHistoricalRewards = { }, fromJSON(object: any): ValidatorHistoricalRewards { - const message = Object.create(baseValidatorHistoricalRewards) as ValidatorHistoricalRewards; + const message = { ...baseValidatorHistoricalRewards } as ValidatorHistoricalRewards; message.cumulativeRewardRatio = []; if (object.cumulativeRewardRatio !== undefined && object.cumulativeRewardRatio !== null) { for (const e of object.cumulativeRewardRatio) { @@ -278,22 +288,6 @@ export const ValidatorHistoricalRewards = { return message; }, - fromPartial(object: DeepPartial): ValidatorHistoricalRewards { - const message = { ...baseValidatorHistoricalRewards } as ValidatorHistoricalRewards; - message.cumulativeRewardRatio = []; - if (object.cumulativeRewardRatio !== undefined && object.cumulativeRewardRatio !== null) { - for (const e of object.cumulativeRewardRatio) { - message.cumulativeRewardRatio.push(DecCoin.fromPartial(e)); - } - } - if (object.referenceCount !== undefined && object.referenceCount !== null) { - message.referenceCount = object.referenceCount; - } else { - message.referenceCount = 0; - } - return message; - }, - toJSON(message: ValidatorHistoricalRewards): unknown { const obj: any = {}; if (message.cumulativeRewardRatio) { @@ -306,6 +300,22 @@ export const ValidatorHistoricalRewards = { message.referenceCount !== undefined && (obj.referenceCount = message.referenceCount); return obj; }, + + fromPartial(object: DeepPartial): ValidatorHistoricalRewards { + const message = { ...baseValidatorHistoricalRewards } as ValidatorHistoricalRewards; + message.cumulativeRewardRatio = []; + if (object.cumulativeRewardRatio !== undefined && object.cumulativeRewardRatio !== null) { + for (const e of object.cumulativeRewardRatio) { + message.cumulativeRewardRatio.push(DecCoin.fromPartial(e)); + } + } + if (object.referenceCount !== undefined && object.referenceCount !== null) { + message.referenceCount = object.referenceCount; + } else { + message.referenceCount = 0; + } + return message; + }, }; const baseValidatorCurrentRewards: object = { period: Long.UZERO }; @@ -315,14 +325,16 @@ export const ValidatorCurrentRewards = { for (const v of message.rewards) { DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); } - writer.uint32(16).uint64(message.period); + if (!message.period.isZero()) { + writer.uint32(16).uint64(message.period); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorCurrentRewards { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseValidatorCurrentRewards) as ValidatorCurrentRewards; + const message = { ...baseValidatorCurrentRewards } as ValidatorCurrentRewards; message.rewards = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -342,7 +354,7 @@ export const ValidatorCurrentRewards = { }, fromJSON(object: any): ValidatorCurrentRewards { - const message = Object.create(baseValidatorCurrentRewards) as ValidatorCurrentRewards; + const message = { ...baseValidatorCurrentRewards } as ValidatorCurrentRewards; message.rewards = []; if (object.rewards !== undefined && object.rewards !== null) { for (const e of object.rewards) { @@ -357,6 +369,17 @@ export const ValidatorCurrentRewards = { return message; }, + toJSON(message: ValidatorCurrentRewards): unknown { + const obj: any = {}; + if (message.rewards) { + obj.rewards = message.rewards.map((e) => (e ? DecCoin.toJSON(e) : undefined)); + } else { + obj.rewards = []; + } + message.period !== undefined && (obj.period = (message.period || Long.UZERO).toString()); + return obj; + }, + fromPartial(object: DeepPartial): ValidatorCurrentRewards { const message = { ...baseValidatorCurrentRewards } as ValidatorCurrentRewards; message.rewards = []; @@ -372,17 +395,6 @@ export const ValidatorCurrentRewards = { } return message; }, - - toJSON(message: ValidatorCurrentRewards): unknown { - const obj: any = {}; - if (message.rewards) { - obj.rewards = message.rewards.map((e) => (e ? DecCoin.toJSON(e) : undefined)); - } else { - obj.rewards = []; - } - message.period !== undefined && (obj.period = (message.period || Long.UZERO).toString()); - return obj; - }, }; const baseValidatorAccumulatedCommission: object = {}; @@ -398,7 +410,7 @@ export const ValidatorAccumulatedCommission = { decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorAccumulatedCommission { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseValidatorAccumulatedCommission) as ValidatorAccumulatedCommission; + const message = { ...baseValidatorAccumulatedCommission } as ValidatorAccumulatedCommission; message.commission = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -415,22 +427,11 @@ export const ValidatorAccumulatedCommission = { }, fromJSON(object: any): ValidatorAccumulatedCommission { - const message = Object.create(baseValidatorAccumulatedCommission) as ValidatorAccumulatedCommission; - message.commission = []; - if (object.commission !== undefined && object.commission !== null) { - for (const e of object.commission) { - message.commission.push(DecCoin.fromJSON(e)); - } - } - return message; - }, - - fromPartial(object: DeepPartial): ValidatorAccumulatedCommission { const message = { ...baseValidatorAccumulatedCommission } as ValidatorAccumulatedCommission; message.commission = []; if (object.commission !== undefined && object.commission !== null) { for (const e of object.commission) { - message.commission.push(DecCoin.fromPartial(e)); + message.commission.push(DecCoin.fromJSON(e)); } } return message; @@ -445,6 +446,17 @@ export const ValidatorAccumulatedCommission = { } return obj; }, + + fromPartial(object: DeepPartial): ValidatorAccumulatedCommission { + const message = { ...baseValidatorAccumulatedCommission } as ValidatorAccumulatedCommission; + message.commission = []; + if (object.commission !== undefined && object.commission !== null) { + for (const e of object.commission) { + message.commission.push(DecCoin.fromPartial(e)); + } + } + return message; + }, }; const baseValidatorOutstandingRewards: object = {}; @@ -460,7 +472,7 @@ export const ValidatorOutstandingRewards = { decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorOutstandingRewards { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseValidatorOutstandingRewards) as ValidatorOutstandingRewards; + const message = { ...baseValidatorOutstandingRewards } as ValidatorOutstandingRewards; message.rewards = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -477,22 +489,11 @@ export const ValidatorOutstandingRewards = { }, fromJSON(object: any): ValidatorOutstandingRewards { - const message = Object.create(baseValidatorOutstandingRewards) as ValidatorOutstandingRewards; - message.rewards = []; - if (object.rewards !== undefined && object.rewards !== null) { - for (const e of object.rewards) { - message.rewards.push(DecCoin.fromJSON(e)); - } - } - return message; - }, - - fromPartial(object: DeepPartial): ValidatorOutstandingRewards { const message = { ...baseValidatorOutstandingRewards } as ValidatorOutstandingRewards; message.rewards = []; if (object.rewards !== undefined && object.rewards !== null) { for (const e of object.rewards) { - message.rewards.push(DecCoin.fromPartial(e)); + message.rewards.push(DecCoin.fromJSON(e)); } } return message; @@ -507,21 +508,36 @@ export const ValidatorOutstandingRewards = { } return obj; }, + + fromPartial(object: DeepPartial): ValidatorOutstandingRewards { + const message = { ...baseValidatorOutstandingRewards } as ValidatorOutstandingRewards; + message.rewards = []; + if (object.rewards !== undefined && object.rewards !== null) { + for (const e of object.rewards) { + message.rewards.push(DecCoin.fromPartial(e)); + } + } + return message; + }, }; const baseValidatorSlashEvent: object = { validatorPeriod: Long.UZERO, fraction: "" }; export const ValidatorSlashEvent = { encode(message: ValidatorSlashEvent, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).uint64(message.validatorPeriod); - writer.uint32(18).string(message.fraction); + if (!message.validatorPeriod.isZero()) { + writer.uint32(8).uint64(message.validatorPeriod); + } + if (message.fraction !== "") { + writer.uint32(18).string(message.fraction); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorSlashEvent { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseValidatorSlashEvent) as ValidatorSlashEvent; + const message = { ...baseValidatorSlashEvent } as ValidatorSlashEvent; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -540,7 +556,7 @@ export const ValidatorSlashEvent = { }, fromJSON(object: any): ValidatorSlashEvent { - const message = Object.create(baseValidatorSlashEvent) as ValidatorSlashEvent; + const message = { ...baseValidatorSlashEvent } as ValidatorSlashEvent; if (object.validatorPeriod !== undefined && object.validatorPeriod !== null) { message.validatorPeriod = Long.fromString(object.validatorPeriod); } else { @@ -554,6 +570,14 @@ export const ValidatorSlashEvent = { return message; }, + toJSON(message: ValidatorSlashEvent): unknown { + const obj: any = {}; + message.validatorPeriod !== undefined && + (obj.validatorPeriod = (message.validatorPeriod || Long.UZERO).toString()); + message.fraction !== undefined && (obj.fraction = message.fraction); + return obj; + }, + fromPartial(object: DeepPartial): ValidatorSlashEvent { const message = { ...baseValidatorSlashEvent } as ValidatorSlashEvent; if (object.validatorPeriod !== undefined && object.validatorPeriod !== null) { @@ -568,14 +592,6 @@ export const ValidatorSlashEvent = { } return message; }, - - toJSON(message: ValidatorSlashEvent): unknown { - const obj: any = {}; - message.validatorPeriod !== undefined && - (obj.validatorPeriod = (message.validatorPeriod || Long.UZERO).toString()); - message.fraction !== undefined && (obj.fraction = message.fraction); - return obj; - }, }; const baseValidatorSlashEvents: object = {}; @@ -591,7 +607,7 @@ export const ValidatorSlashEvents = { decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorSlashEvents { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseValidatorSlashEvents) as ValidatorSlashEvents; + const message = { ...baseValidatorSlashEvents } as ValidatorSlashEvents; message.validatorSlashEvents = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -608,22 +624,11 @@ export const ValidatorSlashEvents = { }, fromJSON(object: any): ValidatorSlashEvents { - const message = Object.create(baseValidatorSlashEvents) as ValidatorSlashEvents; - message.validatorSlashEvents = []; - if (object.validatorSlashEvents !== undefined && object.validatorSlashEvents !== null) { - for (const e of object.validatorSlashEvents) { - message.validatorSlashEvents.push(ValidatorSlashEvent.fromJSON(e)); - } - } - return message; - }, - - fromPartial(object: DeepPartial): ValidatorSlashEvents { const message = { ...baseValidatorSlashEvents } as ValidatorSlashEvents; message.validatorSlashEvents = []; if (object.validatorSlashEvents !== undefined && object.validatorSlashEvents !== null) { for (const e of object.validatorSlashEvents) { - message.validatorSlashEvents.push(ValidatorSlashEvent.fromPartial(e)); + message.validatorSlashEvents.push(ValidatorSlashEvent.fromJSON(e)); } } return message; @@ -640,6 +645,17 @@ export const ValidatorSlashEvents = { } return obj; }, + + fromPartial(object: DeepPartial): ValidatorSlashEvents { + const message = { ...baseValidatorSlashEvents } as ValidatorSlashEvents; + message.validatorSlashEvents = []; + if (object.validatorSlashEvents !== undefined && object.validatorSlashEvents !== null) { + for (const e of object.validatorSlashEvents) { + message.validatorSlashEvents.push(ValidatorSlashEvent.fromPartial(e)); + } + } + return message; + }, }; const baseFeePool: object = {}; @@ -655,7 +671,7 @@ export const FeePool = { decode(input: _m0.Reader | Uint8Array, length?: number): FeePool { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseFeePool) as FeePool; + const message = { ...baseFeePool } as FeePool; message.communityPool = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -672,22 +688,11 @@ export const FeePool = { }, fromJSON(object: any): FeePool { - const message = Object.create(baseFeePool) as FeePool; - message.communityPool = []; - if (object.communityPool !== undefined && object.communityPool !== null) { - for (const e of object.communityPool) { - message.communityPool.push(DecCoin.fromJSON(e)); - } - } - return message; - }, - - fromPartial(object: DeepPartial): FeePool { const message = { ...baseFeePool } as FeePool; message.communityPool = []; if (object.communityPool !== undefined && object.communityPool !== null) { for (const e of object.communityPool) { - message.communityPool.push(DecCoin.fromPartial(e)); + message.communityPool.push(DecCoin.fromJSON(e)); } } return message; @@ -702,15 +707,32 @@ export const FeePool = { } return obj; }, + + fromPartial(object: DeepPartial): FeePool { + const message = { ...baseFeePool } as FeePool; + message.communityPool = []; + if (object.communityPool !== undefined && object.communityPool !== null) { + for (const e of object.communityPool) { + message.communityPool.push(DecCoin.fromPartial(e)); + } + } + return message; + }, }; const baseCommunityPoolSpendProposal: object = { title: "", description: "", recipient: "" }; export const CommunityPoolSpendProposal = { encode(message: CommunityPoolSpendProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.title); - writer.uint32(18).string(message.description); - writer.uint32(26).string(message.recipient); + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.recipient !== "") { + writer.uint32(26).string(message.recipient); + } for (const v of message.amount) { Coin.encode(v!, writer.uint32(34).fork()).ldelim(); } @@ -720,7 +742,7 @@ export const CommunityPoolSpendProposal = { decode(input: _m0.Reader | Uint8Array, length?: number): CommunityPoolSpendProposal { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseCommunityPoolSpendProposal) as CommunityPoolSpendProposal; + const message = { ...baseCommunityPoolSpendProposal } as CommunityPoolSpendProposal; message.amount = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -746,7 +768,7 @@ export const CommunityPoolSpendProposal = { }, fromJSON(object: any): CommunityPoolSpendProposal { - const message = Object.create(baseCommunityPoolSpendProposal) as CommunityPoolSpendProposal; + const message = { ...baseCommunityPoolSpendProposal } as CommunityPoolSpendProposal; message.amount = []; if (object.title !== undefined && object.title !== null) { message.title = String(object.title); @@ -771,6 +793,19 @@ export const CommunityPoolSpendProposal = { return message; }, + toJSON(message: CommunityPoolSpendProposal): unknown { + const obj: any = {}; + message.title !== undefined && (obj.title = message.title); + message.description !== undefined && (obj.description = message.description); + message.recipient !== undefined && (obj.recipient = message.recipient); + if (message.amount) { + obj.amount = message.amount.map((e) => (e ? Coin.toJSON(e) : undefined)); + } else { + obj.amount = []; + } + return obj; + }, + fromPartial(object: DeepPartial): CommunityPoolSpendProposal { const message = { ...baseCommunityPoolSpendProposal } as CommunityPoolSpendProposal; message.amount = []; @@ -796,35 +831,28 @@ export const CommunityPoolSpendProposal = { } return message; }, - - toJSON(message: CommunityPoolSpendProposal): unknown { - const obj: any = {}; - message.title !== undefined && (obj.title = message.title); - message.description !== undefined && (obj.description = message.description); - message.recipient !== undefined && (obj.recipient = message.recipient); - if (message.amount) { - obj.amount = message.amount.map((e) => (e ? Coin.toJSON(e) : undefined)); - } else { - obj.amount = []; - } - return obj; - }, }; const baseDelegatorStartingInfo: object = { previousPeriod: Long.UZERO, stake: "", height: Long.UZERO }; export const DelegatorStartingInfo = { encode(message: DelegatorStartingInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).uint64(message.previousPeriod); - writer.uint32(18).string(message.stake); - writer.uint32(24).uint64(message.height); + if (!message.previousPeriod.isZero()) { + writer.uint32(8).uint64(message.previousPeriod); + } + if (message.stake !== "") { + writer.uint32(18).string(message.stake); + } + if (!message.height.isZero()) { + writer.uint32(24).uint64(message.height); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): DelegatorStartingInfo { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseDelegatorStartingInfo) as DelegatorStartingInfo; + const message = { ...baseDelegatorStartingInfo } as DelegatorStartingInfo; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -846,7 +874,7 @@ export const DelegatorStartingInfo = { }, fromJSON(object: any): DelegatorStartingInfo { - const message = Object.create(baseDelegatorStartingInfo) as DelegatorStartingInfo; + const message = { ...baseDelegatorStartingInfo } as DelegatorStartingInfo; if (object.previousPeriod !== undefined && object.previousPeriod !== null) { message.previousPeriod = Long.fromString(object.previousPeriod); } else { @@ -865,6 +893,15 @@ export const DelegatorStartingInfo = { return message; }, + toJSON(message: DelegatorStartingInfo): unknown { + const obj: any = {}; + message.previousPeriod !== undefined && + (obj.previousPeriod = (message.previousPeriod || Long.UZERO).toString()); + message.stake !== undefined && (obj.stake = message.stake); + message.height !== undefined && (obj.height = (message.height || Long.UZERO).toString()); + return obj; + }, + fromPartial(object: DeepPartial): DelegatorStartingInfo { const message = { ...baseDelegatorStartingInfo } as DelegatorStartingInfo; if (object.previousPeriod !== undefined && object.previousPeriod !== null) { @@ -884,22 +921,15 @@ export const DelegatorStartingInfo = { } return message; }, - - toJSON(message: DelegatorStartingInfo): unknown { - const obj: any = {}; - message.previousPeriod !== undefined && - (obj.previousPeriod = (message.previousPeriod || Long.UZERO).toString()); - message.stake !== undefined && (obj.stake = message.stake); - message.height !== undefined && (obj.height = (message.height || Long.UZERO).toString()); - return obj; - }, }; const baseDelegationDelegatorReward: object = { validatorAddress: "" }; export const DelegationDelegatorReward = { encode(message: DelegationDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.validatorAddress); + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } for (const v of message.reward) { DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); } @@ -909,7 +939,7 @@ export const DelegationDelegatorReward = { decode(input: _m0.Reader | Uint8Array, length?: number): DelegationDelegatorReward { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseDelegationDelegatorReward) as DelegationDelegatorReward; + const message = { ...baseDelegationDelegatorReward } as DelegationDelegatorReward; message.reward = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -929,7 +959,7 @@ export const DelegationDelegatorReward = { }, fromJSON(object: any): DelegationDelegatorReward { - const message = Object.create(baseDelegationDelegatorReward) as DelegationDelegatorReward; + const message = { ...baseDelegationDelegatorReward } as DelegationDelegatorReward; message.reward = []; if (object.validatorAddress !== undefined && object.validatorAddress !== null) { message.validatorAddress = String(object.validatorAddress); @@ -944,6 +974,17 @@ export const DelegationDelegatorReward = { return message; }, + toJSON(message: DelegationDelegatorReward): unknown { + const obj: any = {}; + message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); + if (message.reward) { + obj.reward = message.reward.map((e) => (e ? DecCoin.toJSON(e) : undefined)); + } else { + obj.reward = []; + } + return obj; + }, + fromPartial(object: DeepPartial): DelegationDelegatorReward { const message = { ...baseDelegationDelegatorReward } as DelegationDelegatorReward; message.reward = []; @@ -959,17 +1000,6 @@ export const DelegationDelegatorReward = { } return message; }, - - toJSON(message: DelegationDelegatorReward): unknown { - const obj: any = {}; - message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); - if (message.reward) { - obj.reward = message.reward.map((e) => (e ? DecCoin.toJSON(e) : undefined)); - } else { - obj.reward = []; - } - return obj; - }, }; const baseCommunityPoolSpendProposalWithDeposit: object = { @@ -985,20 +1015,28 @@ export const CommunityPoolSpendProposalWithDeposit = { message: CommunityPoolSpendProposalWithDeposit, writer: _m0.Writer = _m0.Writer.create(), ): _m0.Writer { - writer.uint32(10).string(message.title); - writer.uint32(18).string(message.description); - writer.uint32(26).string(message.recipient); - writer.uint32(34).string(message.amount); - writer.uint32(42).string(message.deposit); + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.recipient !== "") { + writer.uint32(26).string(message.recipient); + } + if (message.amount !== "") { + writer.uint32(34).string(message.amount); + } + if (message.deposit !== "") { + writer.uint32(42).string(message.deposit); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): CommunityPoolSpendProposalWithDeposit { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create( - baseCommunityPoolSpendProposalWithDeposit, - ) as CommunityPoolSpendProposalWithDeposit; + const message = { ...baseCommunityPoolSpendProposalWithDeposit } as CommunityPoolSpendProposalWithDeposit; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1026,9 +1064,7 @@ export const CommunityPoolSpendProposalWithDeposit = { }, fromJSON(object: any): CommunityPoolSpendProposalWithDeposit { - const message = Object.create( - baseCommunityPoolSpendProposalWithDeposit, - ) as CommunityPoolSpendProposalWithDeposit; + const message = { ...baseCommunityPoolSpendProposalWithDeposit } as CommunityPoolSpendProposalWithDeposit; if (object.title !== undefined && object.title !== null) { message.title = String(object.title); } else { @@ -1057,6 +1093,16 @@ export const CommunityPoolSpendProposalWithDeposit = { return message; }, + toJSON(message: CommunityPoolSpendProposalWithDeposit): unknown { + const obj: any = {}; + message.title !== undefined && (obj.title = message.title); + message.description !== undefined && (obj.description = message.description); + message.recipient !== undefined && (obj.recipient = message.recipient); + message.amount !== undefined && (obj.amount = message.amount); + message.deposit !== undefined && (obj.deposit = message.deposit); + return obj; + }, + fromPartial( object: DeepPartial, ): CommunityPoolSpendProposalWithDeposit { @@ -1088,16 +1134,6 @@ export const CommunityPoolSpendProposalWithDeposit = { } return message; }, - - toJSON(message: CommunityPoolSpendProposalWithDeposit): unknown { - const obj: any = {}; - message.title !== undefined && (obj.title = message.title); - message.description !== undefined && (obj.description = message.description); - message.recipient !== undefined && (obj.recipient = message.recipient); - message.amount !== undefined && (obj.amount = message.amount); - message.deposit !== undefined && (obj.deposit = message.deposit); - return obj; - }, }; type Builtin = Date | Function | Uint8Array | string | number | undefined | Long; diff --git a/packages/stargate/src/codec/cosmos/distribution/v1beta1/query.ts b/packages/stargate/src/codec/cosmos/distribution/v1beta1/query.ts index 4f242a54..4e264cf4 100644 --- a/packages/stargate/src/codec/cosmos/distribution/v1beta1/query.ts +++ b/packages/stargate/src/codec/cosmos/distribution/v1beta1/query.ts @@ -184,7 +184,7 @@ export const QueryParamsRequest = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryParamsRequest) as QueryParamsRequest; + const message = { ...baseQueryParamsRequest } as QueryParamsRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -197,11 +197,6 @@ export const QueryParamsRequest = { }, fromJSON(_: any): QueryParamsRequest { - const message = Object.create(baseQueryParamsRequest) as QueryParamsRequest; - return message; - }, - - fromPartial(_: DeepPartial): QueryParamsRequest { const message = { ...baseQueryParamsRequest } as QueryParamsRequest; return message; }, @@ -210,6 +205,11 @@ export const QueryParamsRequest = { const obj: any = {}; return obj; }, + + fromPartial(_: DeepPartial): QueryParamsRequest { + const message = { ...baseQueryParamsRequest } as QueryParamsRequest; + return message; + }, }; const baseQueryParamsResponse: object = {}; @@ -225,7 +225,7 @@ export const QueryParamsResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryParamsResponse) as QueryParamsResponse; + const message = { ...baseQueryParamsResponse } as QueryParamsResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -241,19 +241,9 @@ export const QueryParamsResponse = { }, fromJSON(object: any): QueryParamsResponse { - const message = Object.create(baseQueryParamsResponse) as QueryParamsResponse; - if (object.params !== undefined && object.params !== null) { - message.params = Params.fromJSON(object.params); - } else { - message.params = undefined; - } - return message; - }, - - fromPartial(object: DeepPartial): QueryParamsResponse { const message = { ...baseQueryParamsResponse } as QueryParamsResponse; if (object.params !== undefined && object.params !== null) { - message.params = Params.fromPartial(object.params); + message.params = Params.fromJSON(object.params); } else { message.params = undefined; } @@ -265,6 +255,16 @@ export const QueryParamsResponse = { message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); 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; + } + return message; + }, }; const baseQueryValidatorOutstandingRewardsRequest: object = { validatorAddress: "" }; @@ -274,16 +274,18 @@ export const QueryValidatorOutstandingRewardsRequest = { message: QueryValidatorOutstandingRewardsRequest, writer: _m0.Writer = _m0.Writer.create(), ): _m0.Writer { - writer.uint32(10).string(message.validatorAddress); + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorOutstandingRewardsRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create( - baseQueryValidatorOutstandingRewardsRequest, - ) as QueryValidatorOutstandingRewardsRequest; + const message = { + ...baseQueryValidatorOutstandingRewardsRequest, + } as QueryValidatorOutstandingRewardsRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -299,9 +301,9 @@ export const QueryValidatorOutstandingRewardsRequest = { }, fromJSON(object: any): QueryValidatorOutstandingRewardsRequest { - const message = Object.create( - baseQueryValidatorOutstandingRewardsRequest, - ) as QueryValidatorOutstandingRewardsRequest; + const message = { + ...baseQueryValidatorOutstandingRewardsRequest, + } as QueryValidatorOutstandingRewardsRequest; if (object.validatorAddress !== undefined && object.validatorAddress !== null) { message.validatorAddress = String(object.validatorAddress); } else { @@ -310,6 +312,12 @@ export const QueryValidatorOutstandingRewardsRequest = { return message; }, + toJSON(message: QueryValidatorOutstandingRewardsRequest): unknown { + const obj: any = {}; + message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); + return obj; + }, + fromPartial( object: DeepPartial, ): QueryValidatorOutstandingRewardsRequest { @@ -323,12 +331,6 @@ export const QueryValidatorOutstandingRewardsRequest = { } return message; }, - - toJSON(message: QueryValidatorOutstandingRewardsRequest): unknown { - const obj: any = {}; - message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); - return obj; - }, }; const baseQueryValidatorOutstandingRewardsResponse: object = {}; @@ -347,9 +349,9 @@ export const QueryValidatorOutstandingRewardsResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorOutstandingRewardsResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create( - baseQueryValidatorOutstandingRewardsResponse, - ) as QueryValidatorOutstandingRewardsResponse; + const message = { + ...baseQueryValidatorOutstandingRewardsResponse, + } as QueryValidatorOutstandingRewardsResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -365,9 +367,9 @@ export const QueryValidatorOutstandingRewardsResponse = { }, fromJSON(object: any): QueryValidatorOutstandingRewardsResponse { - const message = Object.create( - baseQueryValidatorOutstandingRewardsResponse, - ) as QueryValidatorOutstandingRewardsResponse; + const message = { + ...baseQueryValidatorOutstandingRewardsResponse, + } as QueryValidatorOutstandingRewardsResponse; if (object.rewards !== undefined && object.rewards !== null) { message.rewards = ValidatorOutstandingRewards.fromJSON(object.rewards); } else { @@ -376,6 +378,13 @@ export const QueryValidatorOutstandingRewardsResponse = { return message; }, + toJSON(message: QueryValidatorOutstandingRewardsResponse): unknown { + const obj: any = {}; + message.rewards !== undefined && + (obj.rewards = message.rewards ? ValidatorOutstandingRewards.toJSON(message.rewards) : undefined); + return obj; + }, + fromPartial( object: DeepPartial, ): QueryValidatorOutstandingRewardsResponse { @@ -389,27 +398,22 @@ export const QueryValidatorOutstandingRewardsResponse = { } return message; }, - - toJSON(message: QueryValidatorOutstandingRewardsResponse): unknown { - const obj: any = {}; - message.rewards !== undefined && - (obj.rewards = message.rewards ? ValidatorOutstandingRewards.toJSON(message.rewards) : undefined); - return obj; - }, }; const baseQueryValidatorCommissionRequest: object = { validatorAddress: "" }; export const QueryValidatorCommissionRequest = { encode(message: QueryValidatorCommissionRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.validatorAddress); + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorCommissionRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryValidatorCommissionRequest) as QueryValidatorCommissionRequest; + const message = { ...baseQueryValidatorCommissionRequest } as QueryValidatorCommissionRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -425,19 +429,9 @@ export const QueryValidatorCommissionRequest = { }, fromJSON(object: any): QueryValidatorCommissionRequest { - const message = Object.create(baseQueryValidatorCommissionRequest) as QueryValidatorCommissionRequest; - if (object.validatorAddress !== undefined && object.validatorAddress !== null) { - message.validatorAddress = String(object.validatorAddress); - } else { - message.validatorAddress = ""; - } - return message; - }, - - fromPartial(object: DeepPartial): QueryValidatorCommissionRequest { const message = { ...baseQueryValidatorCommissionRequest } as QueryValidatorCommissionRequest; if (object.validatorAddress !== undefined && object.validatorAddress !== null) { - message.validatorAddress = object.validatorAddress; + message.validatorAddress = String(object.validatorAddress); } else { message.validatorAddress = ""; } @@ -449,6 +443,16 @@ export const QueryValidatorCommissionRequest = { message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); return obj; }, + + fromPartial(object: DeepPartial): QueryValidatorCommissionRequest { + const message = { ...baseQueryValidatorCommissionRequest } as QueryValidatorCommissionRequest; + if (object.validatorAddress !== undefined && object.validatorAddress !== null) { + message.validatorAddress = object.validatorAddress; + } else { + message.validatorAddress = ""; + } + return message; + }, }; const baseQueryValidatorCommissionResponse: object = {}; @@ -464,7 +468,7 @@ export const QueryValidatorCommissionResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorCommissionResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryValidatorCommissionResponse) as QueryValidatorCommissionResponse; + const message = { ...baseQueryValidatorCommissionResponse } as QueryValidatorCommissionResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -480,19 +484,9 @@ export const QueryValidatorCommissionResponse = { }, fromJSON(object: any): QueryValidatorCommissionResponse { - const message = Object.create(baseQueryValidatorCommissionResponse) as QueryValidatorCommissionResponse; - if (object.commission !== undefined && object.commission !== null) { - message.commission = ValidatorAccumulatedCommission.fromJSON(object.commission); - } else { - message.commission = undefined; - } - return message; - }, - - fromPartial(object: DeepPartial): QueryValidatorCommissionResponse { const message = { ...baseQueryValidatorCommissionResponse } as QueryValidatorCommissionResponse; if (object.commission !== undefined && object.commission !== null) { - message.commission = ValidatorAccumulatedCommission.fromPartial(object.commission); + message.commission = ValidatorAccumulatedCommission.fromJSON(object.commission); } else { message.commission = undefined; } @@ -507,6 +501,16 @@ export const QueryValidatorCommissionResponse = { : undefined); return obj; }, + + fromPartial(object: DeepPartial): QueryValidatorCommissionResponse { + const message = { ...baseQueryValidatorCommissionResponse } as QueryValidatorCommissionResponse; + if (object.commission !== undefined && object.commission !== null) { + message.commission = ValidatorAccumulatedCommission.fromPartial(object.commission); + } else { + message.commission = undefined; + } + return message; + }, }; const baseQueryValidatorSlashesRequest: object = { @@ -517,9 +521,15 @@ const baseQueryValidatorSlashesRequest: object = { export const QueryValidatorSlashesRequest = { encode(message: QueryValidatorSlashesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.validatorAddress); - writer.uint32(16).uint64(message.startingHeight); - writer.uint32(24).uint64(message.endingHeight); + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + if (!message.startingHeight.isZero()) { + writer.uint32(16).uint64(message.startingHeight); + } + if (!message.endingHeight.isZero()) { + writer.uint32(24).uint64(message.endingHeight); + } if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(34).fork()).ldelim(); } @@ -529,7 +539,7 @@ export const QueryValidatorSlashesRequest = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorSlashesRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryValidatorSlashesRequest) as QueryValidatorSlashesRequest; + const message = { ...baseQueryValidatorSlashesRequest } as QueryValidatorSlashesRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -554,7 +564,7 @@ export const QueryValidatorSlashesRequest = { }, fromJSON(object: any): QueryValidatorSlashesRequest { - const message = Object.create(baseQueryValidatorSlashesRequest) as QueryValidatorSlashesRequest; + const message = { ...baseQueryValidatorSlashesRequest } as QueryValidatorSlashesRequest; if (object.validatorAddress !== undefined && object.validatorAddress !== null) { message.validatorAddress = String(object.validatorAddress); } else { @@ -578,6 +588,18 @@ export const QueryValidatorSlashesRequest = { return message; }, + toJSON(message: QueryValidatorSlashesRequest): unknown { + const obj: any = {}; + message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); + message.startingHeight !== undefined && + (obj.startingHeight = (message.startingHeight || Long.UZERO).toString()); + message.endingHeight !== undefined && + (obj.endingHeight = (message.endingHeight || Long.UZERO).toString()); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): QueryValidatorSlashesRequest { const message = { ...baseQueryValidatorSlashesRequest } as QueryValidatorSlashesRequest; if (object.validatorAddress !== undefined && object.validatorAddress !== null) { @@ -602,18 +624,6 @@ export const QueryValidatorSlashesRequest = { } return message; }, - - toJSON(message: QueryValidatorSlashesRequest): unknown { - const obj: any = {}; - message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); - message.startingHeight !== undefined && - (obj.startingHeight = (message.startingHeight || Long.UZERO).toString()); - message.endingHeight !== undefined && - (obj.endingHeight = (message.endingHeight || Long.UZERO).toString()); - message.pagination !== undefined && - (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); - return obj; - }, }; const baseQueryValidatorSlashesResponse: object = {}; @@ -632,7 +642,7 @@ export const QueryValidatorSlashesResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorSlashesResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryValidatorSlashesResponse) as QueryValidatorSlashesResponse; + const message = { ...baseQueryValidatorSlashesResponse } as QueryValidatorSlashesResponse; message.slashes = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -652,7 +662,7 @@ export const QueryValidatorSlashesResponse = { }, fromJSON(object: any): QueryValidatorSlashesResponse { - const message = Object.create(baseQueryValidatorSlashesResponse) as QueryValidatorSlashesResponse; + const message = { ...baseQueryValidatorSlashesResponse } as QueryValidatorSlashesResponse; message.slashes = []; if (object.slashes !== undefined && object.slashes !== null) { for (const e of object.slashes) { @@ -667,22 +677,6 @@ export const QueryValidatorSlashesResponse = { return message; }, - fromPartial(object: DeepPartial): QueryValidatorSlashesResponse { - const message = { ...baseQueryValidatorSlashesResponse } as QueryValidatorSlashesResponse; - message.slashes = []; - if (object.slashes !== undefined && object.slashes !== null) { - for (const e of object.slashes) { - message.slashes.push(ValidatorSlashEvent.fromPartial(e)); - } - } - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageResponse.fromPartial(object.pagination); - } else { - message.pagination = undefined; - } - return message; - }, - toJSON(message: QueryValidatorSlashesResponse): unknown { const obj: any = {}; if (message.slashes) { @@ -694,21 +688,41 @@ export const QueryValidatorSlashesResponse = { (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); return obj; }, + + fromPartial(object: DeepPartial): QueryValidatorSlashesResponse { + const message = { ...baseQueryValidatorSlashesResponse } as QueryValidatorSlashesResponse; + message.slashes = []; + if (object.slashes !== undefined && object.slashes !== null) { + for (const e of object.slashes) { + message.slashes.push(ValidatorSlashEvent.fromPartial(e)); + } + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromPartial(object.pagination); + } else { + message.pagination = undefined; + } + return message; + }, }; const baseQueryDelegationRewardsRequest: object = { delegatorAddress: "", validatorAddress: "" }; export const QueryDelegationRewardsRequest = { encode(message: QueryDelegationRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.delegatorAddress); - writer.uint32(18).string(message.validatorAddress); + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationRewardsRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryDelegationRewardsRequest) as QueryDelegationRewardsRequest; + const message = { ...baseQueryDelegationRewardsRequest } as QueryDelegationRewardsRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -727,7 +741,7 @@ export const QueryDelegationRewardsRequest = { }, fromJSON(object: any): QueryDelegationRewardsRequest { - const message = Object.create(baseQueryDelegationRewardsRequest) as QueryDelegationRewardsRequest; + const message = { ...baseQueryDelegationRewardsRequest } as QueryDelegationRewardsRequest; if (object.delegatorAddress !== undefined && object.delegatorAddress !== null) { message.delegatorAddress = String(object.delegatorAddress); } else { @@ -741,6 +755,13 @@ export const QueryDelegationRewardsRequest = { return message; }, + toJSON(message: QueryDelegationRewardsRequest): unknown { + const obj: any = {}; + message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); + message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); + return obj; + }, + fromPartial(object: DeepPartial): QueryDelegationRewardsRequest { const message = { ...baseQueryDelegationRewardsRequest } as QueryDelegationRewardsRequest; if (object.delegatorAddress !== undefined && object.delegatorAddress !== null) { @@ -755,13 +776,6 @@ export const QueryDelegationRewardsRequest = { } return message; }, - - toJSON(message: QueryDelegationRewardsRequest): unknown { - const obj: any = {}; - message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); - message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); - return obj; - }, }; const baseQueryDelegationRewardsResponse: object = {}; @@ -777,7 +791,7 @@ export const QueryDelegationRewardsResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationRewardsResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryDelegationRewardsResponse) as QueryDelegationRewardsResponse; + const message = { ...baseQueryDelegationRewardsResponse } as QueryDelegationRewardsResponse; message.rewards = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -794,22 +808,11 @@ export const QueryDelegationRewardsResponse = { }, fromJSON(object: any): QueryDelegationRewardsResponse { - const message = Object.create(baseQueryDelegationRewardsResponse) as QueryDelegationRewardsResponse; - message.rewards = []; - if (object.rewards !== undefined && object.rewards !== null) { - for (const e of object.rewards) { - message.rewards.push(DecCoin.fromJSON(e)); - } - } - return message; - }, - - fromPartial(object: DeepPartial): QueryDelegationRewardsResponse { const message = { ...baseQueryDelegationRewardsResponse } as QueryDelegationRewardsResponse; message.rewards = []; if (object.rewards !== undefined && object.rewards !== null) { for (const e of object.rewards) { - message.rewards.push(DecCoin.fromPartial(e)); + message.rewards.push(DecCoin.fromJSON(e)); } } return message; @@ -824,22 +827,33 @@ export const QueryDelegationRewardsResponse = { } return obj; }, + + fromPartial(object: DeepPartial): QueryDelegationRewardsResponse { + const message = { ...baseQueryDelegationRewardsResponse } as QueryDelegationRewardsResponse; + message.rewards = []; + if (object.rewards !== undefined && object.rewards !== null) { + for (const e of object.rewards) { + message.rewards.push(DecCoin.fromPartial(e)); + } + } + return message; + }, }; const baseQueryDelegationTotalRewardsRequest: object = { delegatorAddress: "" }; export const QueryDelegationTotalRewardsRequest = { encode(message: QueryDelegationTotalRewardsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.delegatorAddress); + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationTotalRewardsRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create( - baseQueryDelegationTotalRewardsRequest, - ) as QueryDelegationTotalRewardsRequest; + const message = { ...baseQueryDelegationTotalRewardsRequest } as QueryDelegationTotalRewardsRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -855,21 +869,9 @@ export const QueryDelegationTotalRewardsRequest = { }, fromJSON(object: any): QueryDelegationTotalRewardsRequest { - const message = Object.create( - baseQueryDelegationTotalRewardsRequest, - ) as QueryDelegationTotalRewardsRequest; - if (object.delegatorAddress !== undefined && object.delegatorAddress !== null) { - message.delegatorAddress = String(object.delegatorAddress); - } else { - message.delegatorAddress = ""; - } - return message; - }, - - fromPartial(object: DeepPartial): QueryDelegationTotalRewardsRequest { const message = { ...baseQueryDelegationTotalRewardsRequest } as QueryDelegationTotalRewardsRequest; if (object.delegatorAddress !== undefined && object.delegatorAddress !== null) { - message.delegatorAddress = object.delegatorAddress; + message.delegatorAddress = String(object.delegatorAddress); } else { message.delegatorAddress = ""; } @@ -881,6 +883,16 @@ export const QueryDelegationTotalRewardsRequest = { message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); return obj; }, + + fromPartial(object: DeepPartial): QueryDelegationTotalRewardsRequest { + const message = { ...baseQueryDelegationTotalRewardsRequest } as QueryDelegationTotalRewardsRequest; + if (object.delegatorAddress !== undefined && object.delegatorAddress !== null) { + message.delegatorAddress = object.delegatorAddress; + } else { + message.delegatorAddress = ""; + } + return message; + }, }; const baseQueryDelegationTotalRewardsResponse: object = {}; @@ -899,9 +911,7 @@ export const QueryDelegationTotalRewardsResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationTotalRewardsResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create( - baseQueryDelegationTotalRewardsResponse, - ) as QueryDelegationTotalRewardsResponse; + const message = { ...baseQueryDelegationTotalRewardsResponse } as QueryDelegationTotalRewardsResponse; message.rewards = []; message.total = []; while (reader.pos < end) { @@ -922,9 +932,7 @@ export const QueryDelegationTotalRewardsResponse = { }, fromJSON(object: any): QueryDelegationTotalRewardsResponse { - const message = Object.create( - baseQueryDelegationTotalRewardsResponse, - ) as QueryDelegationTotalRewardsResponse; + const message = { ...baseQueryDelegationTotalRewardsResponse } as QueryDelegationTotalRewardsResponse; message.rewards = []; message.total = []; if (object.rewards !== undefined && object.rewards !== null) { @@ -940,23 +948,6 @@ export const QueryDelegationTotalRewardsResponse = { return message; }, - fromPartial(object: DeepPartial): QueryDelegationTotalRewardsResponse { - const message = { ...baseQueryDelegationTotalRewardsResponse } as QueryDelegationTotalRewardsResponse; - message.rewards = []; - message.total = []; - if (object.rewards !== undefined && object.rewards !== null) { - for (const e of object.rewards) { - message.rewards.push(DelegationDelegatorReward.fromPartial(e)); - } - } - if (object.total !== undefined && object.total !== null) { - for (const e of object.total) { - message.total.push(DecCoin.fromPartial(e)); - } - } - return message; - }, - toJSON(message: QueryDelegationTotalRewardsResponse): unknown { const obj: any = {}; if (message.rewards) { @@ -971,20 +962,39 @@ export const QueryDelegationTotalRewardsResponse = { } return obj; }, + + fromPartial(object: DeepPartial): QueryDelegationTotalRewardsResponse { + const message = { ...baseQueryDelegationTotalRewardsResponse } as QueryDelegationTotalRewardsResponse; + message.rewards = []; + message.total = []; + if (object.rewards !== undefined && object.rewards !== null) { + for (const e of object.rewards) { + message.rewards.push(DelegationDelegatorReward.fromPartial(e)); + } + } + if (object.total !== undefined && object.total !== null) { + for (const e of object.total) { + message.total.push(DecCoin.fromPartial(e)); + } + } + return message; + }, }; const baseQueryDelegatorValidatorsRequest: object = { delegatorAddress: "" }; export const QueryDelegatorValidatorsRequest = { encode(message: QueryDelegatorValidatorsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.delegatorAddress); + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorValidatorsRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryDelegatorValidatorsRequest) as QueryDelegatorValidatorsRequest; + const message = { ...baseQueryDelegatorValidatorsRequest } as QueryDelegatorValidatorsRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1000,19 +1010,9 @@ export const QueryDelegatorValidatorsRequest = { }, fromJSON(object: any): QueryDelegatorValidatorsRequest { - const message = Object.create(baseQueryDelegatorValidatorsRequest) as QueryDelegatorValidatorsRequest; - if (object.delegatorAddress !== undefined && object.delegatorAddress !== null) { - message.delegatorAddress = String(object.delegatorAddress); - } else { - message.delegatorAddress = ""; - } - return message; - }, - - fromPartial(object: DeepPartial): QueryDelegatorValidatorsRequest { const message = { ...baseQueryDelegatorValidatorsRequest } as QueryDelegatorValidatorsRequest; if (object.delegatorAddress !== undefined && object.delegatorAddress !== null) { - message.delegatorAddress = object.delegatorAddress; + message.delegatorAddress = String(object.delegatorAddress); } else { message.delegatorAddress = ""; } @@ -1024,6 +1024,16 @@ export const QueryDelegatorValidatorsRequest = { message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); return obj; }, + + fromPartial(object: DeepPartial): QueryDelegatorValidatorsRequest { + const message = { ...baseQueryDelegatorValidatorsRequest } as QueryDelegatorValidatorsRequest; + if (object.delegatorAddress !== undefined && object.delegatorAddress !== null) { + message.delegatorAddress = object.delegatorAddress; + } else { + message.delegatorAddress = ""; + } + return message; + }, }; const baseQueryDelegatorValidatorsResponse: object = { validators: "" }; @@ -1039,7 +1049,7 @@ export const QueryDelegatorValidatorsResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorValidatorsResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryDelegatorValidatorsResponse) as QueryDelegatorValidatorsResponse; + const message = { ...baseQueryDelegatorValidatorsResponse } as QueryDelegatorValidatorsResponse; message.validators = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -1056,22 +1066,11 @@ export const QueryDelegatorValidatorsResponse = { }, fromJSON(object: any): QueryDelegatorValidatorsResponse { - const message = Object.create(baseQueryDelegatorValidatorsResponse) as QueryDelegatorValidatorsResponse; - message.validators = []; - if (object.validators !== undefined && object.validators !== null) { - for (const e of object.validators) { - message.validators.push(String(e)); - } - } - return message; - }, - - 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(e); + message.validators.push(String(e)); } } return message; @@ -1086,6 +1085,17 @@ 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(e); + } + } + return message; + }, }; const baseQueryDelegatorWithdrawAddressRequest: object = { delegatorAddress: "" }; @@ -1095,16 +1105,16 @@ export const QueryDelegatorWithdrawAddressRequest = { message: QueryDelegatorWithdrawAddressRequest, writer: _m0.Writer = _m0.Writer.create(), ): _m0.Writer { - writer.uint32(10).string(message.delegatorAddress); + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create( - baseQueryDelegatorWithdrawAddressRequest, - ) as QueryDelegatorWithdrawAddressRequest; + const message = { ...baseQueryDelegatorWithdrawAddressRequest } as QueryDelegatorWithdrawAddressRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1120,9 +1130,7 @@ export const QueryDelegatorWithdrawAddressRequest = { }, fromJSON(object: any): QueryDelegatorWithdrawAddressRequest { - const message = Object.create( - baseQueryDelegatorWithdrawAddressRequest, - ) as QueryDelegatorWithdrawAddressRequest; + const message = { ...baseQueryDelegatorWithdrawAddressRequest } as QueryDelegatorWithdrawAddressRequest; if (object.delegatorAddress !== undefined && object.delegatorAddress !== null) { message.delegatorAddress = String(object.delegatorAddress); } else { @@ -1131,6 +1139,12 @@ export const QueryDelegatorWithdrawAddressRequest = { return message; }, + toJSON(message: QueryDelegatorWithdrawAddressRequest): unknown { + const obj: any = {}; + message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); + return obj; + }, + fromPartial( object: DeepPartial, ): QueryDelegatorWithdrawAddressRequest { @@ -1142,12 +1156,6 @@ export const QueryDelegatorWithdrawAddressRequest = { } return message; }, - - toJSON(message: QueryDelegatorWithdrawAddressRequest): unknown { - const obj: any = {}; - message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); - return obj; - }, }; const baseQueryDelegatorWithdrawAddressResponse: object = { withdrawAddress: "" }; @@ -1157,16 +1165,16 @@ export const QueryDelegatorWithdrawAddressResponse = { message: QueryDelegatorWithdrawAddressResponse, writer: _m0.Writer = _m0.Writer.create(), ): _m0.Writer { - writer.uint32(10).string(message.withdrawAddress); + if (message.withdrawAddress !== "") { + writer.uint32(10).string(message.withdrawAddress); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create( - baseQueryDelegatorWithdrawAddressResponse, - ) as QueryDelegatorWithdrawAddressResponse; + const message = { ...baseQueryDelegatorWithdrawAddressResponse } as QueryDelegatorWithdrawAddressResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1182,9 +1190,7 @@ export const QueryDelegatorWithdrawAddressResponse = { }, fromJSON(object: any): QueryDelegatorWithdrawAddressResponse { - const message = Object.create( - baseQueryDelegatorWithdrawAddressResponse, - ) as QueryDelegatorWithdrawAddressResponse; + const message = { ...baseQueryDelegatorWithdrawAddressResponse } as QueryDelegatorWithdrawAddressResponse; if (object.withdrawAddress !== undefined && object.withdrawAddress !== null) { message.withdrawAddress = String(object.withdrawAddress); } else { @@ -1193,6 +1199,12 @@ export const QueryDelegatorWithdrawAddressResponse = { return message; }, + toJSON(message: QueryDelegatorWithdrawAddressResponse): unknown { + const obj: any = {}; + message.withdrawAddress !== undefined && (obj.withdrawAddress = message.withdrawAddress); + return obj; + }, + fromPartial( object: DeepPartial, ): QueryDelegatorWithdrawAddressResponse { @@ -1204,12 +1216,6 @@ export const QueryDelegatorWithdrawAddressResponse = { } return message; }, - - toJSON(message: QueryDelegatorWithdrawAddressResponse): unknown { - const obj: any = {}; - message.withdrawAddress !== undefined && (obj.withdrawAddress = message.withdrawAddress); - return obj; - }, }; const baseQueryCommunityPoolRequest: object = {}; @@ -1222,7 +1228,7 @@ export const QueryCommunityPoolRequest = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryCommunityPoolRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryCommunityPoolRequest) as QueryCommunityPoolRequest; + const message = { ...baseQueryCommunityPoolRequest } as QueryCommunityPoolRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1235,11 +1241,6 @@ export const QueryCommunityPoolRequest = { }, fromJSON(_: any): QueryCommunityPoolRequest { - const message = Object.create(baseQueryCommunityPoolRequest) as QueryCommunityPoolRequest; - return message; - }, - - fromPartial(_: DeepPartial): QueryCommunityPoolRequest { const message = { ...baseQueryCommunityPoolRequest } as QueryCommunityPoolRequest; return message; }, @@ -1248,6 +1249,11 @@ export const QueryCommunityPoolRequest = { const obj: any = {}; return obj; }, + + fromPartial(_: DeepPartial): QueryCommunityPoolRequest { + const message = { ...baseQueryCommunityPoolRequest } as QueryCommunityPoolRequest; + return message; + }, }; const baseQueryCommunityPoolResponse: object = {}; @@ -1263,7 +1269,7 @@ export const QueryCommunityPoolResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryCommunityPoolResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryCommunityPoolResponse) as QueryCommunityPoolResponse; + const message = { ...baseQueryCommunityPoolResponse } as QueryCommunityPoolResponse; message.pool = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -1280,22 +1286,11 @@ export const QueryCommunityPoolResponse = { }, fromJSON(object: any): QueryCommunityPoolResponse { - const message = Object.create(baseQueryCommunityPoolResponse) as QueryCommunityPoolResponse; - message.pool = []; - if (object.pool !== undefined && object.pool !== null) { - for (const e of object.pool) { - message.pool.push(DecCoin.fromJSON(e)); - } - } - return message; - }, - - fromPartial(object: DeepPartial): QueryCommunityPoolResponse { const message = { ...baseQueryCommunityPoolResponse } as QueryCommunityPoolResponse; message.pool = []; if (object.pool !== undefined && object.pool !== null) { for (const e of object.pool) { - message.pool.push(DecCoin.fromPartial(e)); + message.pool.push(DecCoin.fromJSON(e)); } } return message; @@ -1310,6 +1305,17 @@ export const QueryCommunityPoolResponse = { } return obj; }, + + fromPartial(object: DeepPartial): QueryCommunityPoolResponse { + const message = { ...baseQueryCommunityPoolResponse } as QueryCommunityPoolResponse; + message.pool = []; + if (object.pool !== undefined && object.pool !== null) { + for (const e of object.pool) { + message.pool.push(DecCoin.fromPartial(e)); + } + } + return message; + }, }; /** Query defines the gRPC querier service for distribution module. */ diff --git a/packages/stargate/src/codec/cosmos/distribution/v1beta1/tx.ts b/packages/stargate/src/codec/cosmos/distribution/v1beta1/tx.ts index 68fce564..4bbde5f3 100644 --- a/packages/stargate/src/codec/cosmos/distribution/v1beta1/tx.ts +++ b/packages/stargate/src/codec/cosmos/distribution/v1beta1/tx.ts @@ -56,15 +56,19 @@ const baseMsgSetWithdrawAddress: object = { delegatorAddress: "", withdrawAddres export const MsgSetWithdrawAddress = { encode(message: MsgSetWithdrawAddress, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.delegatorAddress); - writer.uint32(18).string(message.withdrawAddress); + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetWithdrawAddress { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseMsgSetWithdrawAddress) as MsgSetWithdrawAddress; + const message = { ...baseMsgSetWithdrawAddress } as MsgSetWithdrawAddress; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -83,7 +87,7 @@ export const MsgSetWithdrawAddress = { }, fromJSON(object: any): MsgSetWithdrawAddress { - const message = Object.create(baseMsgSetWithdrawAddress) as MsgSetWithdrawAddress; + const message = { ...baseMsgSetWithdrawAddress } as MsgSetWithdrawAddress; if (object.delegatorAddress !== undefined && object.delegatorAddress !== null) { message.delegatorAddress = String(object.delegatorAddress); } else { @@ -97,6 +101,13 @@ export const MsgSetWithdrawAddress = { return message; }, + toJSON(message: MsgSetWithdrawAddress): unknown { + const obj: any = {}; + message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); + message.withdrawAddress !== undefined && (obj.withdrawAddress = message.withdrawAddress); + return obj; + }, + fromPartial(object: DeepPartial): MsgSetWithdrawAddress { const message = { ...baseMsgSetWithdrawAddress } as MsgSetWithdrawAddress; if (object.delegatorAddress !== undefined && object.delegatorAddress !== null) { @@ -111,13 +122,6 @@ export const MsgSetWithdrawAddress = { } return message; }, - - toJSON(message: MsgSetWithdrawAddress): unknown { - const obj: any = {}; - message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); - message.withdrawAddress !== undefined && (obj.withdrawAddress = message.withdrawAddress); - return obj; - }, }; const baseMsgSetWithdrawAddressResponse: object = {}; @@ -130,7 +134,7 @@ export const MsgSetWithdrawAddressResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetWithdrawAddressResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseMsgSetWithdrawAddressResponse) as MsgSetWithdrawAddressResponse; + const message = { ...baseMsgSetWithdrawAddressResponse } as MsgSetWithdrawAddressResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -143,11 +147,6 @@ export const MsgSetWithdrawAddressResponse = { }, fromJSON(_: any): MsgSetWithdrawAddressResponse { - const message = Object.create(baseMsgSetWithdrawAddressResponse) as MsgSetWithdrawAddressResponse; - return message; - }, - - fromPartial(_: DeepPartial): MsgSetWithdrawAddressResponse { const message = { ...baseMsgSetWithdrawAddressResponse } as MsgSetWithdrawAddressResponse; return message; }, @@ -156,21 +155,30 @@ export const MsgSetWithdrawAddressResponse = { const obj: any = {}; return obj; }, + + fromPartial(_: DeepPartial): MsgSetWithdrawAddressResponse { + const message = { ...baseMsgSetWithdrawAddressResponse } as MsgSetWithdrawAddressResponse; + return message; + }, }; const baseMsgWithdrawDelegatorReward: object = { delegatorAddress: "", validatorAddress: "" }; export const MsgWithdrawDelegatorReward = { encode(message: MsgWithdrawDelegatorReward, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.delegatorAddress); - writer.uint32(18).string(message.validatorAddress); + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawDelegatorReward { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseMsgWithdrawDelegatorReward) as MsgWithdrawDelegatorReward; + const message = { ...baseMsgWithdrawDelegatorReward } as MsgWithdrawDelegatorReward; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -189,7 +197,7 @@ export const MsgWithdrawDelegatorReward = { }, fromJSON(object: any): MsgWithdrawDelegatorReward { - const message = Object.create(baseMsgWithdrawDelegatorReward) as MsgWithdrawDelegatorReward; + const message = { ...baseMsgWithdrawDelegatorReward } as MsgWithdrawDelegatorReward; if (object.delegatorAddress !== undefined && object.delegatorAddress !== null) { message.delegatorAddress = String(object.delegatorAddress); } else { @@ -203,6 +211,13 @@ export const MsgWithdrawDelegatorReward = { return message; }, + toJSON(message: MsgWithdrawDelegatorReward): unknown { + const obj: any = {}; + message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); + message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); + return obj; + }, + fromPartial(object: DeepPartial): MsgWithdrawDelegatorReward { const message = { ...baseMsgWithdrawDelegatorReward } as MsgWithdrawDelegatorReward; if (object.delegatorAddress !== undefined && object.delegatorAddress !== null) { @@ -217,13 +232,6 @@ export const MsgWithdrawDelegatorReward = { } return message; }, - - toJSON(message: MsgWithdrawDelegatorReward): unknown { - const obj: any = {}; - message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); - message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); - return obj; - }, }; const baseMsgWithdrawDelegatorRewardResponse: object = {}; @@ -236,9 +244,7 @@ export const MsgWithdrawDelegatorRewardResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawDelegatorRewardResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create( - baseMsgWithdrawDelegatorRewardResponse, - ) as MsgWithdrawDelegatorRewardResponse; + const message = { ...baseMsgWithdrawDelegatorRewardResponse } as MsgWithdrawDelegatorRewardResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -251,13 +257,6 @@ export const MsgWithdrawDelegatorRewardResponse = { }, fromJSON(_: any): MsgWithdrawDelegatorRewardResponse { - const message = Object.create( - baseMsgWithdrawDelegatorRewardResponse, - ) as MsgWithdrawDelegatorRewardResponse; - return message; - }, - - fromPartial(_: DeepPartial): MsgWithdrawDelegatorRewardResponse { const message = { ...baseMsgWithdrawDelegatorRewardResponse } as MsgWithdrawDelegatorRewardResponse; return message; }, @@ -266,20 +265,27 @@ export const MsgWithdrawDelegatorRewardResponse = { const obj: any = {}; return obj; }, + + fromPartial(_: DeepPartial): MsgWithdrawDelegatorRewardResponse { + const message = { ...baseMsgWithdrawDelegatorRewardResponse } as MsgWithdrawDelegatorRewardResponse; + return message; + }, }; const baseMsgWithdrawValidatorCommission: object = { validatorAddress: "" }; export const MsgWithdrawValidatorCommission = { encode(message: MsgWithdrawValidatorCommission, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.validatorAddress); + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawValidatorCommission { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseMsgWithdrawValidatorCommission) as MsgWithdrawValidatorCommission; + const message = { ...baseMsgWithdrawValidatorCommission } as MsgWithdrawValidatorCommission; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -295,19 +301,9 @@ export const MsgWithdrawValidatorCommission = { }, fromJSON(object: any): MsgWithdrawValidatorCommission { - const message = Object.create(baseMsgWithdrawValidatorCommission) as MsgWithdrawValidatorCommission; - if (object.validatorAddress !== undefined && object.validatorAddress !== null) { - message.validatorAddress = String(object.validatorAddress); - } else { - message.validatorAddress = ""; - } - return message; - }, - - fromPartial(object: DeepPartial): MsgWithdrawValidatorCommission { const message = { ...baseMsgWithdrawValidatorCommission } as MsgWithdrawValidatorCommission; if (object.validatorAddress !== undefined && object.validatorAddress !== null) { - message.validatorAddress = object.validatorAddress; + message.validatorAddress = String(object.validatorAddress); } else { message.validatorAddress = ""; } @@ -319,6 +315,16 @@ export const MsgWithdrawValidatorCommission = { message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); return obj; }, + + fromPartial(object: DeepPartial): MsgWithdrawValidatorCommission { + const message = { ...baseMsgWithdrawValidatorCommission } as MsgWithdrawValidatorCommission; + if (object.validatorAddress !== undefined && object.validatorAddress !== null) { + message.validatorAddress = object.validatorAddress; + } else { + message.validatorAddress = ""; + } + return message; + }, }; const baseMsgWithdrawValidatorCommissionResponse: object = {}; @@ -331,9 +337,9 @@ export const MsgWithdrawValidatorCommissionResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): MsgWithdrawValidatorCommissionResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create( - baseMsgWithdrawValidatorCommissionResponse, - ) as MsgWithdrawValidatorCommissionResponse; + const message = { + ...baseMsgWithdrawValidatorCommissionResponse, + } as MsgWithdrawValidatorCommissionResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -346,15 +352,6 @@ export const MsgWithdrawValidatorCommissionResponse = { }, fromJSON(_: any): MsgWithdrawValidatorCommissionResponse { - const message = Object.create( - baseMsgWithdrawValidatorCommissionResponse, - ) as MsgWithdrawValidatorCommissionResponse; - return message; - }, - - fromPartial( - _: DeepPartial, - ): MsgWithdrawValidatorCommissionResponse { const message = { ...baseMsgWithdrawValidatorCommissionResponse, } as MsgWithdrawValidatorCommissionResponse; @@ -365,6 +362,15 @@ export const MsgWithdrawValidatorCommissionResponse = { const obj: any = {}; return obj; }, + + fromPartial( + _: DeepPartial, + ): MsgWithdrawValidatorCommissionResponse { + const message = { + ...baseMsgWithdrawValidatorCommissionResponse, + } as MsgWithdrawValidatorCommissionResponse; + return message; + }, }; const baseMsgFundCommunityPool: object = { depositor: "" }; @@ -374,14 +380,16 @@ export const MsgFundCommunityPool = { for (const v of message.amount) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); } - writer.uint32(18).string(message.depositor); + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgFundCommunityPool { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseMsgFundCommunityPool) as MsgFundCommunityPool; + const message = { ...baseMsgFundCommunityPool } as MsgFundCommunityPool; message.amount = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -401,7 +409,7 @@ export const MsgFundCommunityPool = { }, fromJSON(object: any): MsgFundCommunityPool { - const message = Object.create(baseMsgFundCommunityPool) as MsgFundCommunityPool; + const message = { ...baseMsgFundCommunityPool } as MsgFundCommunityPool; message.amount = []; if (object.amount !== undefined && object.amount !== null) { for (const e of object.amount) { @@ -416,6 +424,17 @@ export const MsgFundCommunityPool = { return message; }, + toJSON(message: MsgFundCommunityPool): unknown { + const obj: any = {}; + if (message.amount) { + obj.amount = message.amount.map((e) => (e ? Coin.toJSON(e) : undefined)); + } else { + obj.amount = []; + } + message.depositor !== undefined && (obj.depositor = message.depositor); + return obj; + }, + fromPartial(object: DeepPartial): MsgFundCommunityPool { const message = { ...baseMsgFundCommunityPool } as MsgFundCommunityPool; message.amount = []; @@ -431,17 +450,6 @@ export const MsgFundCommunityPool = { } return message; }, - - toJSON(message: MsgFundCommunityPool): unknown { - const obj: any = {}; - if (message.amount) { - obj.amount = message.amount.map((e) => (e ? Coin.toJSON(e) : undefined)); - } else { - obj.amount = []; - } - message.depositor !== undefined && (obj.depositor = message.depositor); - return obj; - }, }; const baseMsgFundCommunityPoolResponse: object = {}; @@ -454,7 +462,7 @@ export const MsgFundCommunityPoolResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): MsgFundCommunityPoolResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseMsgFundCommunityPoolResponse) as MsgFundCommunityPoolResponse; + const message = { ...baseMsgFundCommunityPoolResponse } as MsgFundCommunityPoolResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -467,11 +475,6 @@ export const MsgFundCommunityPoolResponse = { }, fromJSON(_: any): MsgFundCommunityPoolResponse { - const message = Object.create(baseMsgFundCommunityPoolResponse) as MsgFundCommunityPoolResponse; - return message; - }, - - fromPartial(_: DeepPartial): MsgFundCommunityPoolResponse { const message = { ...baseMsgFundCommunityPoolResponse } as MsgFundCommunityPoolResponse; return message; }, @@ -480,6 +483,11 @@ export const MsgFundCommunityPoolResponse = { const obj: any = {}; return obj; }, + + fromPartial(_: DeepPartial): MsgFundCommunityPoolResponse { + const message = { ...baseMsgFundCommunityPoolResponse } as MsgFundCommunityPoolResponse; + return message; + }, }; /** Msg defines the distribution Msg service. */ diff --git a/packages/stargate/src/codec/cosmos/staking/v1beta1/query.ts b/packages/stargate/src/codec/cosmos/staking/v1beta1/query.ts index c22d6f9b..3dbc572d 100644 --- a/packages/stargate/src/codec/cosmos/staking/v1beta1/query.ts +++ b/packages/stargate/src/codec/cosmos/staking/v1beta1/query.ts @@ -268,7 +268,9 @@ const baseQueryValidatorsRequest: object = { status: "" }; export const QueryValidatorsRequest = { encode(message: QueryValidatorsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.status); + if (message.status !== "") { + writer.uint32(10).string(message.status); + } if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } @@ -278,7 +280,7 @@ export const QueryValidatorsRequest = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorsRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryValidatorsRequest) as QueryValidatorsRequest; + const message = { ...baseQueryValidatorsRequest } as QueryValidatorsRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -297,7 +299,7 @@ export const QueryValidatorsRequest = { }, fromJSON(object: any): QueryValidatorsRequest { - const message = Object.create(baseQueryValidatorsRequest) as QueryValidatorsRequest; + const message = { ...baseQueryValidatorsRequest } as QueryValidatorsRequest; if (object.status !== undefined && object.status !== null) { message.status = String(object.status); } else { @@ -311,6 +313,14 @@ export const QueryValidatorsRequest = { return message; }, + toJSON(message: QueryValidatorsRequest): unknown { + const obj: any = {}; + message.status !== undefined && (obj.status = message.status); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): QueryValidatorsRequest { const message = { ...baseQueryValidatorsRequest } as QueryValidatorsRequest; if (object.status !== undefined && object.status !== null) { @@ -325,14 +335,6 @@ export const QueryValidatorsRequest = { } return message; }, - - toJSON(message: QueryValidatorsRequest): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status); - message.pagination !== undefined && - (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); - return obj; - }, }; const baseQueryValidatorsResponse: object = {}; @@ -351,7 +353,7 @@ export const QueryValidatorsResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorsResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryValidatorsResponse) as QueryValidatorsResponse; + const message = { ...baseQueryValidatorsResponse } as QueryValidatorsResponse; message.validators = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -371,7 +373,7 @@ export const QueryValidatorsResponse = { }, fromJSON(object: any): QueryValidatorsResponse { - const message = Object.create(baseQueryValidatorsResponse) as QueryValidatorsResponse; + const message = { ...baseQueryValidatorsResponse } as QueryValidatorsResponse; message.validators = []; if (object.validators !== undefined && object.validators !== null) { for (const e of object.validators) { @@ -386,22 +388,6 @@ export const QueryValidatorsResponse = { return message; }, - 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; - } - return message; - }, - toJSON(message: QueryValidatorsResponse): unknown { const obj: any = {}; if (message.validators) { @@ -413,20 +399,38 @@ export const QueryValidatorsResponse = { (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); 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; + } + return message; + }, }; const baseQueryValidatorRequest: object = { validatorAddr: "" }; export const QueryValidatorRequest = { encode(message: QueryValidatorRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.validatorAddr); + if (message.validatorAddr !== "") { + writer.uint32(10).string(message.validatorAddr); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryValidatorRequest) as QueryValidatorRequest; + const message = { ...baseQueryValidatorRequest } as QueryValidatorRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -442,19 +446,9 @@ export const QueryValidatorRequest = { }, fromJSON(object: any): QueryValidatorRequest { - const message = Object.create(baseQueryValidatorRequest) as QueryValidatorRequest; - if (object.validatorAddr !== undefined && object.validatorAddr !== null) { - message.validatorAddr = String(object.validatorAddr); - } else { - message.validatorAddr = ""; - } - return message; - }, - - fromPartial(object: DeepPartial): QueryValidatorRequest { const message = { ...baseQueryValidatorRequest } as QueryValidatorRequest; if (object.validatorAddr !== undefined && object.validatorAddr !== null) { - message.validatorAddr = object.validatorAddr; + message.validatorAddr = String(object.validatorAddr); } else { message.validatorAddr = ""; } @@ -466,6 +460,16 @@ export const QueryValidatorRequest = { message.validatorAddr !== undefined && (obj.validatorAddr = message.validatorAddr); return obj; }, + + fromPartial(object: DeepPartial): QueryValidatorRequest { + const message = { ...baseQueryValidatorRequest } as QueryValidatorRequest; + if (object.validatorAddr !== undefined && object.validatorAddr !== null) { + message.validatorAddr = object.validatorAddr; + } else { + message.validatorAddr = ""; + } + return message; + }, }; const baseQueryValidatorResponse: object = {}; @@ -481,7 +485,7 @@ export const QueryValidatorResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryValidatorResponse) as QueryValidatorResponse; + const message = { ...baseQueryValidatorResponse } as QueryValidatorResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -497,19 +501,9 @@ export const QueryValidatorResponse = { }, fromJSON(object: any): QueryValidatorResponse { - const message = Object.create(baseQueryValidatorResponse) as QueryValidatorResponse; - if (object.validator !== undefined && object.validator !== null) { - message.validator = Validator.fromJSON(object.validator); - } else { - message.validator = undefined; - } - return message; - }, - - fromPartial(object: DeepPartial): QueryValidatorResponse { const message = { ...baseQueryValidatorResponse } as QueryValidatorResponse; if (object.validator !== undefined && object.validator !== null) { - message.validator = Validator.fromPartial(object.validator); + message.validator = Validator.fromJSON(object.validator); } else { message.validator = undefined; } @@ -522,13 +516,25 @@ export const QueryValidatorResponse = { (obj.validator = message.validator ? Validator.toJSON(message.validator) : undefined); 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; + } + return message; + }, }; const baseQueryValidatorDelegationsRequest: object = { validatorAddr: "" }; export const QueryValidatorDelegationsRequest = { encode(message: QueryValidatorDelegationsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.validatorAddr); + if (message.validatorAddr !== "") { + writer.uint32(10).string(message.validatorAddr); + } if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } @@ -538,7 +544,7 @@ export const QueryValidatorDelegationsRequest = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDelegationsRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryValidatorDelegationsRequest) as QueryValidatorDelegationsRequest; + const message = { ...baseQueryValidatorDelegationsRequest } as QueryValidatorDelegationsRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -557,7 +563,7 @@ export const QueryValidatorDelegationsRequest = { }, fromJSON(object: any): QueryValidatorDelegationsRequest { - const message = Object.create(baseQueryValidatorDelegationsRequest) as QueryValidatorDelegationsRequest; + const message = { ...baseQueryValidatorDelegationsRequest } as QueryValidatorDelegationsRequest; if (object.validatorAddr !== undefined && object.validatorAddr !== null) { message.validatorAddr = String(object.validatorAddr); } else { @@ -571,6 +577,14 @@ export const QueryValidatorDelegationsRequest = { return message; }, + toJSON(message: QueryValidatorDelegationsRequest): unknown { + const obj: any = {}; + message.validatorAddr !== undefined && (obj.validatorAddr = message.validatorAddr); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): QueryValidatorDelegationsRequest { const message = { ...baseQueryValidatorDelegationsRequest } as QueryValidatorDelegationsRequest; if (object.validatorAddr !== undefined && object.validatorAddr !== null) { @@ -585,14 +599,6 @@ export const QueryValidatorDelegationsRequest = { } return message; }, - - toJSON(message: QueryValidatorDelegationsRequest): unknown { - const obj: any = {}; - message.validatorAddr !== undefined && (obj.validatorAddr = message.validatorAddr); - message.pagination !== undefined && - (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); - return obj; - }, }; const baseQueryValidatorDelegationsResponse: object = {}; @@ -611,7 +617,7 @@ export const QueryValidatorDelegationsResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorDelegationsResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryValidatorDelegationsResponse) as QueryValidatorDelegationsResponse; + const message = { ...baseQueryValidatorDelegationsResponse } as QueryValidatorDelegationsResponse; message.delegationResponses = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -631,7 +637,7 @@ export const QueryValidatorDelegationsResponse = { }, fromJSON(object: any): QueryValidatorDelegationsResponse { - const message = Object.create(baseQueryValidatorDelegationsResponse) as QueryValidatorDelegationsResponse; + const message = { ...baseQueryValidatorDelegationsResponse } as QueryValidatorDelegationsResponse; message.delegationResponses = []; if (object.delegationResponses !== undefined && object.delegationResponses !== null) { for (const e of object.delegationResponses) { @@ -646,22 +652,6 @@ export const QueryValidatorDelegationsResponse = { return message; }, - 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; - } - return message; - }, - toJSON(message: QueryValidatorDelegationsResponse): unknown { const obj: any = {}; if (message.delegationResponses) { @@ -675,6 +665,22 @@ export const QueryValidatorDelegationsResponse = { (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); 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; + } + return message; + }, }; const baseQueryValidatorUnbondingDelegationsRequest: object = { validatorAddr: "" }; @@ -684,7 +690,9 @@ export const QueryValidatorUnbondingDelegationsRequest = { message: QueryValidatorUnbondingDelegationsRequest, writer: _m0.Writer = _m0.Writer.create(), ): _m0.Writer { - writer.uint32(10).string(message.validatorAddr); + if (message.validatorAddr !== "") { + writer.uint32(10).string(message.validatorAddr); + } if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } @@ -694,9 +702,9 @@ export const QueryValidatorUnbondingDelegationsRequest = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorUnbondingDelegationsRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create( - baseQueryValidatorUnbondingDelegationsRequest, - ) as QueryValidatorUnbondingDelegationsRequest; + const message = { + ...baseQueryValidatorUnbondingDelegationsRequest, + } as QueryValidatorUnbondingDelegationsRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -715,9 +723,9 @@ export const QueryValidatorUnbondingDelegationsRequest = { }, fromJSON(object: any): QueryValidatorUnbondingDelegationsRequest { - const message = Object.create( - baseQueryValidatorUnbondingDelegationsRequest, - ) as QueryValidatorUnbondingDelegationsRequest; + const message = { + ...baseQueryValidatorUnbondingDelegationsRequest, + } as QueryValidatorUnbondingDelegationsRequest; if (object.validatorAddr !== undefined && object.validatorAddr !== null) { message.validatorAddr = String(object.validatorAddr); } else { @@ -731,6 +739,14 @@ export const QueryValidatorUnbondingDelegationsRequest = { return message; }, + toJSON(message: QueryValidatorUnbondingDelegationsRequest): unknown { + const obj: any = {}; + message.validatorAddr !== undefined && (obj.validatorAddr = message.validatorAddr); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial( object: DeepPartial, ): QueryValidatorUnbondingDelegationsRequest { @@ -749,14 +765,6 @@ export const QueryValidatorUnbondingDelegationsRequest = { } return message; }, - - toJSON(message: QueryValidatorUnbondingDelegationsRequest): unknown { - const obj: any = {}; - message.validatorAddr !== undefined && (obj.validatorAddr = message.validatorAddr); - message.pagination !== undefined && - (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); - return obj; - }, }; const baseQueryValidatorUnbondingDelegationsResponse: object = {}; @@ -778,9 +786,9 @@ export const QueryValidatorUnbondingDelegationsResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryValidatorUnbondingDelegationsResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create( - baseQueryValidatorUnbondingDelegationsResponse, - ) as QueryValidatorUnbondingDelegationsResponse; + const message = { + ...baseQueryValidatorUnbondingDelegationsResponse, + } as QueryValidatorUnbondingDelegationsResponse; message.unbondingResponses = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -800,9 +808,9 @@ export const QueryValidatorUnbondingDelegationsResponse = { }, fromJSON(object: any): QueryValidatorUnbondingDelegationsResponse { - const message = Object.create( - baseQueryValidatorUnbondingDelegationsResponse, - ) as QueryValidatorUnbondingDelegationsResponse; + const message = { + ...baseQueryValidatorUnbondingDelegationsResponse, + } as QueryValidatorUnbondingDelegationsResponse; message.unbondingResponses = []; if (object.unbondingResponses !== undefined && object.unbondingResponses !== null) { for (const e of object.unbondingResponses) { @@ -817,6 +825,20 @@ export const QueryValidatorUnbondingDelegationsResponse = { return message; }, + toJSON(message: QueryValidatorUnbondingDelegationsResponse): unknown { + const obj: any = {}; + if (message.unbondingResponses) { + obj.unbondingResponses = message.unbondingResponses.map((e) => + e ? UnbondingDelegation.toJSON(e) : undefined, + ); + } else { + obj.unbondingResponses = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial( object: DeepPartial, ): QueryValidatorUnbondingDelegationsResponse { @@ -836,35 +858,25 @@ export const QueryValidatorUnbondingDelegationsResponse = { } return message; }, - - toJSON(message: QueryValidatorUnbondingDelegationsResponse): unknown { - const obj: any = {}; - if (message.unbondingResponses) { - obj.unbondingResponses = message.unbondingResponses.map((e) => - e ? UnbondingDelegation.toJSON(e) : undefined, - ); - } else { - obj.unbondingResponses = []; - } - message.pagination !== undefined && - (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); - return obj; - }, }; const baseQueryDelegationRequest: object = { delegatorAddr: "", validatorAddr: "" }; export const QueryDelegationRequest = { encode(message: QueryDelegationRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.delegatorAddr); - writer.uint32(18).string(message.validatorAddr); + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.validatorAddr !== "") { + writer.uint32(18).string(message.validatorAddr); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryDelegationRequest) as QueryDelegationRequest; + const message = { ...baseQueryDelegationRequest } as QueryDelegationRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -883,7 +895,7 @@ export const QueryDelegationRequest = { }, fromJSON(object: any): QueryDelegationRequest { - const message = Object.create(baseQueryDelegationRequest) as QueryDelegationRequest; + const message = { ...baseQueryDelegationRequest } as QueryDelegationRequest; if (object.delegatorAddr !== undefined && object.delegatorAddr !== null) { message.delegatorAddr = String(object.delegatorAddr); } else { @@ -897,6 +909,13 @@ export const QueryDelegationRequest = { return message; }, + toJSON(message: QueryDelegationRequest): unknown { + const obj: any = {}; + message.delegatorAddr !== undefined && (obj.delegatorAddr = message.delegatorAddr); + message.validatorAddr !== undefined && (obj.validatorAddr = message.validatorAddr); + return obj; + }, + fromPartial(object: DeepPartial): QueryDelegationRequest { const message = { ...baseQueryDelegationRequest } as QueryDelegationRequest; if (object.delegatorAddr !== undefined && object.delegatorAddr !== null) { @@ -911,13 +930,6 @@ export const QueryDelegationRequest = { } return message; }, - - toJSON(message: QueryDelegationRequest): unknown { - const obj: any = {}; - message.delegatorAddr !== undefined && (obj.delegatorAddr = message.delegatorAddr); - message.validatorAddr !== undefined && (obj.validatorAddr = message.validatorAddr); - return obj; - }, }; const baseQueryDelegationResponse: object = {}; @@ -933,7 +945,7 @@ export const QueryDelegationResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegationResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryDelegationResponse) as QueryDelegationResponse; + const message = { ...baseQueryDelegationResponse } as QueryDelegationResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -949,19 +961,9 @@ export const QueryDelegationResponse = { }, fromJSON(object: any): QueryDelegationResponse { - const message = Object.create(baseQueryDelegationResponse) as QueryDelegationResponse; - if (object.delegationResponse !== undefined && object.delegationResponse !== null) { - message.delegationResponse = DelegationResponse.fromJSON(object.delegationResponse); - } else { - message.delegationResponse = undefined; - } - return message; - }, - - fromPartial(object: DeepPartial): QueryDelegationResponse { const message = { ...baseQueryDelegationResponse } as QueryDelegationResponse; if (object.delegationResponse !== undefined && object.delegationResponse !== null) { - message.delegationResponse = DelegationResponse.fromPartial(object.delegationResponse); + message.delegationResponse = DelegationResponse.fromJSON(object.delegationResponse); } else { message.delegationResponse = undefined; } @@ -976,21 +978,35 @@ export const QueryDelegationResponse = { : undefined); 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; + } + return message; + }, }; const baseQueryUnbondingDelegationRequest: object = { delegatorAddr: "", validatorAddr: "" }; export const QueryUnbondingDelegationRequest = { encode(message: QueryUnbondingDelegationRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.delegatorAddr); - writer.uint32(18).string(message.validatorAddr); + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.validatorAddr !== "") { + writer.uint32(18).string(message.validatorAddr); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryUnbondingDelegationRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryUnbondingDelegationRequest) as QueryUnbondingDelegationRequest; + const message = { ...baseQueryUnbondingDelegationRequest } as QueryUnbondingDelegationRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1009,7 +1025,7 @@ export const QueryUnbondingDelegationRequest = { }, fromJSON(object: any): QueryUnbondingDelegationRequest { - const message = Object.create(baseQueryUnbondingDelegationRequest) as QueryUnbondingDelegationRequest; + const message = { ...baseQueryUnbondingDelegationRequest } as QueryUnbondingDelegationRequest; if (object.delegatorAddr !== undefined && object.delegatorAddr !== null) { message.delegatorAddr = String(object.delegatorAddr); } else { @@ -1023,6 +1039,13 @@ export const QueryUnbondingDelegationRequest = { return message; }, + toJSON(message: QueryUnbondingDelegationRequest): unknown { + const obj: any = {}; + message.delegatorAddr !== undefined && (obj.delegatorAddr = message.delegatorAddr); + message.validatorAddr !== undefined && (obj.validatorAddr = message.validatorAddr); + return obj; + }, + fromPartial(object: DeepPartial): QueryUnbondingDelegationRequest { const message = { ...baseQueryUnbondingDelegationRequest } as QueryUnbondingDelegationRequest; if (object.delegatorAddr !== undefined && object.delegatorAddr !== null) { @@ -1037,13 +1060,6 @@ export const QueryUnbondingDelegationRequest = { } return message; }, - - toJSON(message: QueryUnbondingDelegationRequest): unknown { - const obj: any = {}; - message.delegatorAddr !== undefined && (obj.delegatorAddr = message.delegatorAddr); - message.validatorAddr !== undefined && (obj.validatorAddr = message.validatorAddr); - return obj; - }, }; const baseQueryUnbondingDelegationResponse: object = {}; @@ -1059,7 +1075,7 @@ export const QueryUnbondingDelegationResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryUnbondingDelegationResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryUnbondingDelegationResponse) as QueryUnbondingDelegationResponse; + const message = { ...baseQueryUnbondingDelegationResponse } as QueryUnbondingDelegationResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1075,19 +1091,9 @@ export const QueryUnbondingDelegationResponse = { }, fromJSON(object: any): QueryUnbondingDelegationResponse { - const message = Object.create(baseQueryUnbondingDelegationResponse) as QueryUnbondingDelegationResponse; - if (object.unbond !== undefined && object.unbond !== null) { - message.unbond = UnbondingDelegation.fromJSON(object.unbond); - } else { - message.unbond = undefined; - } - return message; - }, - - fromPartial(object: DeepPartial): QueryUnbondingDelegationResponse { const message = { ...baseQueryUnbondingDelegationResponse } as QueryUnbondingDelegationResponse; if (object.unbond !== undefined && object.unbond !== null) { - message.unbond = UnbondingDelegation.fromPartial(object.unbond); + message.unbond = UnbondingDelegation.fromJSON(object.unbond); } else { message.unbond = undefined; } @@ -1100,13 +1106,25 @@ export const QueryUnbondingDelegationResponse = { (obj.unbond = message.unbond ? UnbondingDelegation.toJSON(message.unbond) : undefined); 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; + } + return message; + }, }; const baseQueryDelegatorDelegationsRequest: object = { delegatorAddr: "" }; export const QueryDelegatorDelegationsRequest = { encode(message: QueryDelegatorDelegationsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.delegatorAddr); + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } @@ -1116,7 +1134,7 @@ export const QueryDelegatorDelegationsRequest = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorDelegationsRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryDelegatorDelegationsRequest) as QueryDelegatorDelegationsRequest; + const message = { ...baseQueryDelegatorDelegationsRequest } as QueryDelegatorDelegationsRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1135,7 +1153,7 @@ export const QueryDelegatorDelegationsRequest = { }, fromJSON(object: any): QueryDelegatorDelegationsRequest { - const message = Object.create(baseQueryDelegatorDelegationsRequest) as QueryDelegatorDelegationsRequest; + const message = { ...baseQueryDelegatorDelegationsRequest } as QueryDelegatorDelegationsRequest; if (object.delegatorAddr !== undefined && object.delegatorAddr !== null) { message.delegatorAddr = String(object.delegatorAddr); } else { @@ -1149,6 +1167,14 @@ export const QueryDelegatorDelegationsRequest = { return message; }, + toJSON(message: QueryDelegatorDelegationsRequest): unknown { + const obj: any = {}; + message.delegatorAddr !== undefined && (obj.delegatorAddr = message.delegatorAddr); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): QueryDelegatorDelegationsRequest { const message = { ...baseQueryDelegatorDelegationsRequest } as QueryDelegatorDelegationsRequest; if (object.delegatorAddr !== undefined && object.delegatorAddr !== null) { @@ -1163,14 +1189,6 @@ export const QueryDelegatorDelegationsRequest = { } return message; }, - - toJSON(message: QueryDelegatorDelegationsRequest): unknown { - const obj: any = {}; - message.delegatorAddr !== undefined && (obj.delegatorAddr = message.delegatorAddr); - message.pagination !== undefined && - (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); - return obj; - }, }; const baseQueryDelegatorDelegationsResponse: object = {}; @@ -1189,7 +1207,7 @@ export const QueryDelegatorDelegationsResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorDelegationsResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryDelegatorDelegationsResponse) as QueryDelegatorDelegationsResponse; + const message = { ...baseQueryDelegatorDelegationsResponse } as QueryDelegatorDelegationsResponse; message.delegationResponses = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -1209,7 +1227,7 @@ export const QueryDelegatorDelegationsResponse = { }, fromJSON(object: any): QueryDelegatorDelegationsResponse { - const message = Object.create(baseQueryDelegatorDelegationsResponse) as QueryDelegatorDelegationsResponse; + const message = { ...baseQueryDelegatorDelegationsResponse } as QueryDelegatorDelegationsResponse; message.delegationResponses = []; if (object.delegationResponses !== undefined && object.delegationResponses !== null) { for (const e of object.delegationResponses) { @@ -1224,22 +1242,6 @@ export const QueryDelegatorDelegationsResponse = { return message; }, - 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; - } - return message; - }, - toJSON(message: QueryDelegatorDelegationsResponse): unknown { const obj: any = {}; if (message.delegationResponses) { @@ -1253,6 +1255,22 @@ export const QueryDelegatorDelegationsResponse = { (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); 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; + } + return message; + }, }; const baseQueryDelegatorUnbondingDelegationsRequest: object = { delegatorAddr: "" }; @@ -1262,7 +1280,9 @@ export const QueryDelegatorUnbondingDelegationsRequest = { message: QueryDelegatorUnbondingDelegationsRequest, writer: _m0.Writer = _m0.Writer.create(), ): _m0.Writer { - writer.uint32(10).string(message.delegatorAddr); + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } @@ -1272,9 +1292,9 @@ export const QueryDelegatorUnbondingDelegationsRequest = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorUnbondingDelegationsRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create( - baseQueryDelegatorUnbondingDelegationsRequest, - ) as QueryDelegatorUnbondingDelegationsRequest; + const message = { + ...baseQueryDelegatorUnbondingDelegationsRequest, + } as QueryDelegatorUnbondingDelegationsRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1293,9 +1313,9 @@ export const QueryDelegatorUnbondingDelegationsRequest = { }, fromJSON(object: any): QueryDelegatorUnbondingDelegationsRequest { - const message = Object.create( - baseQueryDelegatorUnbondingDelegationsRequest, - ) as QueryDelegatorUnbondingDelegationsRequest; + const message = { + ...baseQueryDelegatorUnbondingDelegationsRequest, + } as QueryDelegatorUnbondingDelegationsRequest; if (object.delegatorAddr !== undefined && object.delegatorAddr !== null) { message.delegatorAddr = String(object.delegatorAddr); } else { @@ -1309,6 +1329,14 @@ export const QueryDelegatorUnbondingDelegationsRequest = { return message; }, + toJSON(message: QueryDelegatorUnbondingDelegationsRequest): unknown { + const obj: any = {}; + message.delegatorAddr !== undefined && (obj.delegatorAddr = message.delegatorAddr); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial( object: DeepPartial, ): QueryDelegatorUnbondingDelegationsRequest { @@ -1327,14 +1355,6 @@ export const QueryDelegatorUnbondingDelegationsRequest = { } return message; }, - - toJSON(message: QueryDelegatorUnbondingDelegationsRequest): unknown { - const obj: any = {}; - message.delegatorAddr !== undefined && (obj.delegatorAddr = message.delegatorAddr); - message.pagination !== undefined && - (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); - return obj; - }, }; const baseQueryDelegatorUnbondingDelegationsResponse: object = {}; @@ -1356,9 +1376,9 @@ export const QueryDelegatorUnbondingDelegationsResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorUnbondingDelegationsResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create( - baseQueryDelegatorUnbondingDelegationsResponse, - ) as QueryDelegatorUnbondingDelegationsResponse; + const message = { + ...baseQueryDelegatorUnbondingDelegationsResponse, + } as QueryDelegatorUnbondingDelegationsResponse; message.unbondingResponses = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -1378,9 +1398,9 @@ export const QueryDelegatorUnbondingDelegationsResponse = { }, fromJSON(object: any): QueryDelegatorUnbondingDelegationsResponse { - const message = Object.create( - baseQueryDelegatorUnbondingDelegationsResponse, - ) as QueryDelegatorUnbondingDelegationsResponse; + const message = { + ...baseQueryDelegatorUnbondingDelegationsResponse, + } as QueryDelegatorUnbondingDelegationsResponse; message.unbondingResponses = []; if (object.unbondingResponses !== undefined && object.unbondingResponses !== null) { for (const e of object.unbondingResponses) { @@ -1395,6 +1415,20 @@ export const QueryDelegatorUnbondingDelegationsResponse = { return message; }, + toJSON(message: QueryDelegatorUnbondingDelegationsResponse): unknown { + const obj: any = {}; + if (message.unbondingResponses) { + obj.unbondingResponses = message.unbondingResponses.map((e) => + e ? UnbondingDelegation.toJSON(e) : undefined, + ); + } else { + obj.unbondingResponses = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial( object: DeepPartial, ): QueryDelegatorUnbondingDelegationsResponse { @@ -1414,20 +1448,6 @@ export const QueryDelegatorUnbondingDelegationsResponse = { } return message; }, - - toJSON(message: QueryDelegatorUnbondingDelegationsResponse): unknown { - const obj: any = {}; - if (message.unbondingResponses) { - obj.unbondingResponses = message.unbondingResponses.map((e) => - e ? UnbondingDelegation.toJSON(e) : undefined, - ); - } else { - obj.unbondingResponses = []; - } - message.pagination !== undefined && - (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); - return obj; - }, }; const baseQueryRedelegationsRequest: object = { @@ -1438,9 +1458,15 @@ const baseQueryRedelegationsRequest: object = { export const QueryRedelegationsRequest = { encode(message: QueryRedelegationsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.delegatorAddr); - writer.uint32(18).string(message.srcValidatorAddr); - writer.uint32(26).string(message.dstValidatorAddr); + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.srcValidatorAddr !== "") { + writer.uint32(18).string(message.srcValidatorAddr); + } + if (message.dstValidatorAddr !== "") { + writer.uint32(26).string(message.dstValidatorAddr); + } if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(34).fork()).ldelim(); } @@ -1450,7 +1476,7 @@ export const QueryRedelegationsRequest = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryRedelegationsRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryRedelegationsRequest) as QueryRedelegationsRequest; + const message = { ...baseQueryRedelegationsRequest } as QueryRedelegationsRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1475,7 +1501,7 @@ export const QueryRedelegationsRequest = { }, fromJSON(object: any): QueryRedelegationsRequest { - const message = Object.create(baseQueryRedelegationsRequest) as QueryRedelegationsRequest; + const message = { ...baseQueryRedelegationsRequest } as QueryRedelegationsRequest; if (object.delegatorAddr !== undefined && object.delegatorAddr !== null) { message.delegatorAddr = String(object.delegatorAddr); } else { @@ -1499,6 +1525,16 @@ export const QueryRedelegationsRequest = { return message; }, + toJSON(message: QueryRedelegationsRequest): unknown { + const obj: any = {}; + message.delegatorAddr !== undefined && (obj.delegatorAddr = message.delegatorAddr); + message.srcValidatorAddr !== undefined && (obj.srcValidatorAddr = message.srcValidatorAddr); + message.dstValidatorAddr !== undefined && (obj.dstValidatorAddr = message.dstValidatorAddr); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): QueryRedelegationsRequest { const message = { ...baseQueryRedelegationsRequest } as QueryRedelegationsRequest; if (object.delegatorAddr !== undefined && object.delegatorAddr !== null) { @@ -1523,16 +1559,6 @@ export const QueryRedelegationsRequest = { } return message; }, - - toJSON(message: QueryRedelegationsRequest): unknown { - const obj: any = {}; - message.delegatorAddr !== undefined && (obj.delegatorAddr = message.delegatorAddr); - message.srcValidatorAddr !== undefined && (obj.srcValidatorAddr = message.srcValidatorAddr); - message.dstValidatorAddr !== undefined && (obj.dstValidatorAddr = message.dstValidatorAddr); - message.pagination !== undefined && - (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); - return obj; - }, }; const baseQueryRedelegationsResponse: object = {}; @@ -1551,7 +1577,7 @@ export const QueryRedelegationsResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryRedelegationsResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryRedelegationsResponse) as QueryRedelegationsResponse; + const message = { ...baseQueryRedelegationsResponse } as QueryRedelegationsResponse; message.redelegationResponses = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -1571,7 +1597,7 @@ export const QueryRedelegationsResponse = { }, fromJSON(object: any): QueryRedelegationsResponse { - const message = Object.create(baseQueryRedelegationsResponse) as QueryRedelegationsResponse; + const message = { ...baseQueryRedelegationsResponse } as QueryRedelegationsResponse; message.redelegationResponses = []; if (object.redelegationResponses !== undefined && object.redelegationResponses !== null) { for (const e of object.redelegationResponses) { @@ -1586,22 +1612,6 @@ export const QueryRedelegationsResponse = { return message; }, - 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; - } - return message; - }, - toJSON(message: QueryRedelegationsResponse): unknown { const obj: any = {}; if (message.redelegationResponses) { @@ -1615,13 +1625,31 @@ export const QueryRedelegationsResponse = { (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); 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; + } + return message; + }, }; const baseQueryDelegatorValidatorsRequest: object = { delegatorAddr: "" }; export const QueryDelegatorValidatorsRequest = { encode(message: QueryDelegatorValidatorsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.delegatorAddr); + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } @@ -1631,7 +1659,7 @@ export const QueryDelegatorValidatorsRequest = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorValidatorsRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryDelegatorValidatorsRequest) as QueryDelegatorValidatorsRequest; + const message = { ...baseQueryDelegatorValidatorsRequest } as QueryDelegatorValidatorsRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1650,7 +1678,7 @@ export const QueryDelegatorValidatorsRequest = { }, fromJSON(object: any): QueryDelegatorValidatorsRequest { - const message = Object.create(baseQueryDelegatorValidatorsRequest) as QueryDelegatorValidatorsRequest; + const message = { ...baseQueryDelegatorValidatorsRequest } as QueryDelegatorValidatorsRequest; if (object.delegatorAddr !== undefined && object.delegatorAddr !== null) { message.delegatorAddr = String(object.delegatorAddr); } else { @@ -1664,6 +1692,14 @@ export const QueryDelegatorValidatorsRequest = { return message; }, + toJSON(message: QueryDelegatorValidatorsRequest): unknown { + const obj: any = {}; + message.delegatorAddr !== undefined && (obj.delegatorAddr = message.delegatorAddr); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): QueryDelegatorValidatorsRequest { const message = { ...baseQueryDelegatorValidatorsRequest } as QueryDelegatorValidatorsRequest; if (object.delegatorAddr !== undefined && object.delegatorAddr !== null) { @@ -1678,14 +1714,6 @@ export const QueryDelegatorValidatorsRequest = { } return message; }, - - toJSON(message: QueryDelegatorValidatorsRequest): unknown { - const obj: any = {}; - message.delegatorAddr !== undefined && (obj.delegatorAddr = message.delegatorAddr); - message.pagination !== undefined && - (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); - return obj; - }, }; const baseQueryDelegatorValidatorsResponse: object = {}; @@ -1704,7 +1732,7 @@ export const QueryDelegatorValidatorsResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorValidatorsResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryDelegatorValidatorsResponse) as QueryDelegatorValidatorsResponse; + const message = { ...baseQueryDelegatorValidatorsResponse } as QueryDelegatorValidatorsResponse; message.validators = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -1724,7 +1752,7 @@ export const QueryDelegatorValidatorsResponse = { }, fromJSON(object: any): QueryDelegatorValidatorsResponse { - const message = Object.create(baseQueryDelegatorValidatorsResponse) as QueryDelegatorValidatorsResponse; + const message = { ...baseQueryDelegatorValidatorsResponse } as QueryDelegatorValidatorsResponse; message.validators = []; if (object.validators !== undefined && object.validators !== null) { for (const e of object.validators) { @@ -1739,22 +1767,6 @@ export const QueryDelegatorValidatorsResponse = { return message; }, - 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; - } - return message; - }, - toJSON(message: QueryDelegatorValidatorsResponse): unknown { const obj: any = {}; if (message.validators) { @@ -1766,21 +1778,41 @@ export const QueryDelegatorValidatorsResponse = { (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); 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; + } + return message; + }, }; const baseQueryDelegatorValidatorRequest: object = { delegatorAddr: "", validatorAddr: "" }; export const QueryDelegatorValidatorRequest = { encode(message: QueryDelegatorValidatorRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.delegatorAddr); - writer.uint32(18).string(message.validatorAddr); + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.validatorAddr !== "") { + writer.uint32(18).string(message.validatorAddr); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorValidatorRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryDelegatorValidatorRequest) as QueryDelegatorValidatorRequest; + const message = { ...baseQueryDelegatorValidatorRequest } as QueryDelegatorValidatorRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1799,7 +1831,7 @@ export const QueryDelegatorValidatorRequest = { }, fromJSON(object: any): QueryDelegatorValidatorRequest { - const message = Object.create(baseQueryDelegatorValidatorRequest) as QueryDelegatorValidatorRequest; + const message = { ...baseQueryDelegatorValidatorRequest } as QueryDelegatorValidatorRequest; if (object.delegatorAddr !== undefined && object.delegatorAddr !== null) { message.delegatorAddr = String(object.delegatorAddr); } else { @@ -1813,6 +1845,13 @@ export const QueryDelegatorValidatorRequest = { return message; }, + toJSON(message: QueryDelegatorValidatorRequest): unknown { + const obj: any = {}; + message.delegatorAddr !== undefined && (obj.delegatorAddr = message.delegatorAddr); + message.validatorAddr !== undefined && (obj.validatorAddr = message.validatorAddr); + return obj; + }, + fromPartial(object: DeepPartial): QueryDelegatorValidatorRequest { const message = { ...baseQueryDelegatorValidatorRequest } as QueryDelegatorValidatorRequest; if (object.delegatorAddr !== undefined && object.delegatorAddr !== null) { @@ -1827,13 +1866,6 @@ export const QueryDelegatorValidatorRequest = { } return message; }, - - toJSON(message: QueryDelegatorValidatorRequest): unknown { - const obj: any = {}; - message.delegatorAddr !== undefined && (obj.delegatorAddr = message.delegatorAddr); - message.validatorAddr !== undefined && (obj.validatorAddr = message.validatorAddr); - return obj; - }, }; const baseQueryDelegatorValidatorResponse: object = {}; @@ -1849,7 +1881,7 @@ export const QueryDelegatorValidatorResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryDelegatorValidatorResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryDelegatorValidatorResponse) as QueryDelegatorValidatorResponse; + const message = { ...baseQueryDelegatorValidatorResponse } as QueryDelegatorValidatorResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1865,19 +1897,9 @@ export const QueryDelegatorValidatorResponse = { }, fromJSON(object: any): QueryDelegatorValidatorResponse { - const message = Object.create(baseQueryDelegatorValidatorResponse) as QueryDelegatorValidatorResponse; - if (object.validator !== undefined && object.validator !== null) { - message.validator = Validator.fromJSON(object.validator); - } else { - message.validator = undefined; - } - return message; - }, - - fromPartial(object: DeepPartial): QueryDelegatorValidatorResponse { const message = { ...baseQueryDelegatorValidatorResponse } as QueryDelegatorValidatorResponse; if (object.validator !== undefined && object.validator !== null) { - message.validator = Validator.fromPartial(object.validator); + message.validator = Validator.fromJSON(object.validator); } else { message.validator = undefined; } @@ -1890,20 +1912,32 @@ export const QueryDelegatorValidatorResponse = { (obj.validator = message.validator ? Validator.toJSON(message.validator) : undefined); 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; + } + return message; + }, }; const baseQueryHistoricalInfoRequest: object = { height: Long.ZERO }; export const QueryHistoricalInfoRequest = { encode(message: QueryHistoricalInfoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).int64(message.height); + if (!message.height.isZero()) { + writer.uint32(8).int64(message.height); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryHistoricalInfoRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryHistoricalInfoRequest) as QueryHistoricalInfoRequest; + const message = { ...baseQueryHistoricalInfoRequest } as QueryHistoricalInfoRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1919,19 +1953,9 @@ export const QueryHistoricalInfoRequest = { }, fromJSON(object: any): QueryHistoricalInfoRequest { - const message = Object.create(baseQueryHistoricalInfoRequest) as QueryHistoricalInfoRequest; - if (object.height !== undefined && object.height !== null) { - message.height = Long.fromString(object.height); - } else { - message.height = Long.ZERO; - } - return message; - }, - - fromPartial(object: DeepPartial): QueryHistoricalInfoRequest { const message = { ...baseQueryHistoricalInfoRequest } as QueryHistoricalInfoRequest; if (object.height !== undefined && object.height !== null) { - message.height = object.height as Long; + message.height = Long.fromString(object.height); } else { message.height = Long.ZERO; } @@ -1943,6 +1967,16 @@ export const QueryHistoricalInfoRequest = { message.height !== undefined && (obj.height = (message.height || Long.ZERO).toString()); 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; + } + return message; + }, }; const baseQueryHistoricalInfoResponse: object = {}; @@ -1958,7 +1992,7 @@ export const QueryHistoricalInfoResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryHistoricalInfoResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryHistoricalInfoResponse) as QueryHistoricalInfoResponse; + const message = { ...baseQueryHistoricalInfoResponse } as QueryHistoricalInfoResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1974,19 +2008,9 @@ export const QueryHistoricalInfoResponse = { }, fromJSON(object: any): QueryHistoricalInfoResponse { - const message = Object.create(baseQueryHistoricalInfoResponse) as QueryHistoricalInfoResponse; - if (object.hist !== undefined && object.hist !== null) { - message.hist = HistoricalInfo.fromJSON(object.hist); - } else { - message.hist = undefined; - } - return message; - }, - - fromPartial(object: DeepPartial): QueryHistoricalInfoResponse { const message = { ...baseQueryHistoricalInfoResponse } as QueryHistoricalInfoResponse; if (object.hist !== undefined && object.hist !== null) { - message.hist = HistoricalInfo.fromPartial(object.hist); + message.hist = HistoricalInfo.fromJSON(object.hist); } else { message.hist = undefined; } @@ -1998,6 +2022,16 @@ export const QueryHistoricalInfoResponse = { message.hist !== undefined && (obj.hist = message.hist ? HistoricalInfo.toJSON(message.hist) : undefined); 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; + } + return message; + }, }; const baseQueryPoolRequest: object = {}; @@ -2010,7 +2044,7 @@ export const QueryPoolRequest = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryPoolRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryPoolRequest) as QueryPoolRequest; + const message = { ...baseQueryPoolRequest } as QueryPoolRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -2023,11 +2057,6 @@ export const QueryPoolRequest = { }, fromJSON(_: any): QueryPoolRequest { - const message = Object.create(baseQueryPoolRequest) as QueryPoolRequest; - return message; - }, - - fromPartial(_: DeepPartial): QueryPoolRequest { const message = { ...baseQueryPoolRequest } as QueryPoolRequest; return message; }, @@ -2036,6 +2065,11 @@ export const QueryPoolRequest = { const obj: any = {}; return obj; }, + + fromPartial(_: DeepPartial): QueryPoolRequest { + const message = { ...baseQueryPoolRequest } as QueryPoolRequest; + return message; + }, }; const baseQueryPoolResponse: object = {}; @@ -2051,7 +2085,7 @@ export const QueryPoolResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryPoolResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryPoolResponse) as QueryPoolResponse; + const message = { ...baseQueryPoolResponse } as QueryPoolResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -2067,19 +2101,9 @@ export const QueryPoolResponse = { }, fromJSON(object: any): QueryPoolResponse { - const message = Object.create(baseQueryPoolResponse) as QueryPoolResponse; - if (object.pool !== undefined && object.pool !== null) { - message.pool = Pool.fromJSON(object.pool); - } else { - message.pool = undefined; - } - return message; - }, - - fromPartial(object: DeepPartial): QueryPoolResponse { const message = { ...baseQueryPoolResponse } as QueryPoolResponse; if (object.pool !== undefined && object.pool !== null) { - message.pool = Pool.fromPartial(object.pool); + message.pool = Pool.fromJSON(object.pool); } else { message.pool = undefined; } @@ -2091,6 +2115,16 @@ export const QueryPoolResponse = { message.pool !== undefined && (obj.pool = message.pool ? Pool.toJSON(message.pool) : undefined); 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; + } + return message; + }, }; const baseQueryParamsRequest: object = {}; @@ -2103,7 +2137,7 @@ export const QueryParamsRequest = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryParamsRequest) as QueryParamsRequest; + const message = { ...baseQueryParamsRequest } as QueryParamsRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -2116,11 +2150,6 @@ export const QueryParamsRequest = { }, fromJSON(_: any): QueryParamsRequest { - const message = Object.create(baseQueryParamsRequest) as QueryParamsRequest; - return message; - }, - - fromPartial(_: DeepPartial): QueryParamsRequest { const message = { ...baseQueryParamsRequest } as QueryParamsRequest; return message; }, @@ -2129,6 +2158,11 @@ export const QueryParamsRequest = { const obj: any = {}; return obj; }, + + fromPartial(_: DeepPartial): QueryParamsRequest { + const message = { ...baseQueryParamsRequest } as QueryParamsRequest; + return message; + }, }; const baseQueryParamsResponse: object = {}; @@ -2144,7 +2178,7 @@ export const QueryParamsResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryParamsResponse) as QueryParamsResponse; + const message = { ...baseQueryParamsResponse } as QueryParamsResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -2160,19 +2194,9 @@ export const QueryParamsResponse = { }, fromJSON(object: any): QueryParamsResponse { - const message = Object.create(baseQueryParamsResponse) as QueryParamsResponse; - if (object.params !== undefined && object.params !== null) { - message.params = Params.fromJSON(object.params); - } else { - message.params = undefined; - } - return message; - }, - - fromPartial(object: DeepPartial): QueryParamsResponse { const message = { ...baseQueryParamsResponse } as QueryParamsResponse; if (object.params !== undefined && object.params !== null) { - message.params = Params.fromPartial(object.params); + message.params = Params.fromJSON(object.params); } else { message.params = undefined; } @@ -2184,6 +2208,16 @@ export const QueryParamsResponse = { message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); 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; + } + return message; + }, }; /** Query defines the gRPC querier service. */ diff --git a/packages/stargate/src/codec/cosmos/staking/v1beta1/staking.ts b/packages/stargate/src/codec/cosmos/staking/v1beta1/staking.ts index 3a717a81..24944a9e 100644 --- a/packages/stargate/src/codec/cosmos/staking/v1beta1/staking.ts +++ b/packages/stargate/src/codec/cosmos/staking/v1beta1/staking.ts @@ -268,7 +268,7 @@ export const HistoricalInfo = { decode(input: _m0.Reader | Uint8Array, length?: number): HistoricalInfo { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseHistoricalInfo) as HistoricalInfo; + const message = { ...baseHistoricalInfo } as HistoricalInfo; message.valset = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -288,7 +288,7 @@ export const HistoricalInfo = { }, fromJSON(object: any): HistoricalInfo { - const message = Object.create(baseHistoricalInfo) as HistoricalInfo; + const message = { ...baseHistoricalInfo } as HistoricalInfo; message.valset = []; if (object.header !== undefined && object.header !== null) { message.header = Header.fromJSON(object.header); @@ -303,6 +303,17 @@ export const HistoricalInfo = { return message; }, + toJSON(message: HistoricalInfo): unknown { + const obj: any = {}; + message.header !== undefined && (obj.header = message.header ? Header.toJSON(message.header) : undefined); + if (message.valset) { + obj.valset = message.valset.map((e) => (e ? Validator.toJSON(e) : undefined)); + } else { + obj.valset = []; + } + return obj; + }, + fromPartial(object: DeepPartial): HistoricalInfo { const message = { ...baseHistoricalInfo } as HistoricalInfo; message.valset = []; @@ -318,33 +329,28 @@ export const HistoricalInfo = { } return message; }, - - toJSON(message: HistoricalInfo): unknown { - const obj: any = {}; - message.header !== undefined && (obj.header = message.header ? Header.toJSON(message.header) : undefined); - if (message.valset) { - obj.valset = message.valset.map((e) => (e ? Validator.toJSON(e) : undefined)); - } else { - obj.valset = []; - } - return obj; - }, }; const baseCommissionRates: object = { rate: "", maxRate: "", maxChangeRate: "" }; export const CommissionRates = { encode(message: CommissionRates, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.rate); - writer.uint32(18).string(message.maxRate); - writer.uint32(26).string(message.maxChangeRate); + if (message.rate !== "") { + writer.uint32(10).string(message.rate); + } + if (message.maxRate !== "") { + writer.uint32(18).string(message.maxRate); + } + if (message.maxChangeRate !== "") { + writer.uint32(26).string(message.maxChangeRate); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): CommissionRates { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseCommissionRates) as CommissionRates; + const message = { ...baseCommissionRates } as CommissionRates; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -366,7 +372,7 @@ export const CommissionRates = { }, fromJSON(object: any): CommissionRates { - const message = Object.create(baseCommissionRates) as CommissionRates; + const message = { ...baseCommissionRates } as CommissionRates; if (object.rate !== undefined && object.rate !== null) { message.rate = String(object.rate); } else { @@ -385,6 +391,14 @@ export const CommissionRates = { return message; }, + toJSON(message: CommissionRates): unknown { + const obj: any = {}; + message.rate !== undefined && (obj.rate = message.rate); + message.maxRate !== undefined && (obj.maxRate = message.maxRate); + message.maxChangeRate !== undefined && (obj.maxChangeRate = message.maxChangeRate); + return obj; + }, + fromPartial(object: DeepPartial): CommissionRates { const message = { ...baseCommissionRates } as CommissionRates; if (object.rate !== undefined && object.rate !== null) { @@ -404,14 +418,6 @@ export const CommissionRates = { } return message; }, - - toJSON(message: CommissionRates): unknown { - const obj: any = {}; - message.rate !== undefined && (obj.rate = message.rate); - message.maxRate !== undefined && (obj.maxRate = message.maxRate); - message.maxChangeRate !== undefined && (obj.maxChangeRate = message.maxChangeRate); - return obj; - }, }; const baseCommission: object = {}; @@ -430,7 +436,7 @@ export const Commission = { decode(input: _m0.Reader | Uint8Array, length?: number): Commission { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseCommission) as Commission; + const message = { ...baseCommission } as Commission; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -449,7 +455,7 @@ export const Commission = { }, fromJSON(object: any): Commission { - const message = Object.create(baseCommission) as Commission; + const message = { ...baseCommission } as Commission; if (object.commissionRates !== undefined && object.commissionRates !== null) { message.commissionRates = CommissionRates.fromJSON(object.commissionRates); } else { @@ -463,21 +469,6 @@ export const Commission = { return message; }, - 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; - } - if (object.updateTime !== undefined && object.updateTime !== null) { - message.updateTime = object.updateTime; - } else { - message.updateTime = undefined; - } - return message; - }, - toJSON(message: Commission): unknown { const obj: any = {}; message.commissionRates !== undefined && @@ -488,24 +479,49 @@ export const Commission = { (obj.updateTime = message.updateTime !== undefined ? message.updateTime.toISOString() : null); 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; + } + if (object.updateTime !== undefined && object.updateTime !== null) { + message.updateTime = object.updateTime; + } else { + message.updateTime = undefined; + } + return message; + }, }; const baseDescription: object = { moniker: "", identity: "", website: "", securityContact: "", details: "" }; export const Description = { encode(message: Description, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.moniker); - writer.uint32(18).string(message.identity); - writer.uint32(26).string(message.website); - writer.uint32(34).string(message.securityContact); - writer.uint32(42).string(message.details); + if (message.moniker !== "") { + writer.uint32(10).string(message.moniker); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.website !== "") { + writer.uint32(26).string(message.website); + } + if (message.securityContact !== "") { + writer.uint32(34).string(message.securityContact); + } + if (message.details !== "") { + writer.uint32(42).string(message.details); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): Description { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseDescription) as Description; + const message = { ...baseDescription } as Description; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -533,7 +549,7 @@ export const Description = { }, fromJSON(object: any): Description { - const message = Object.create(baseDescription) as Description; + const message = { ...baseDescription } as Description; if (object.moniker !== undefined && object.moniker !== null) { message.moniker = String(object.moniker); } else { @@ -562,6 +578,16 @@ export const Description = { return message; }, + toJSON(message: Description): unknown { + const obj: any = {}; + message.moniker !== undefined && (obj.moniker = message.moniker); + message.identity !== undefined && (obj.identity = message.identity); + message.website !== undefined && (obj.website = message.website); + message.securityContact !== undefined && (obj.securityContact = message.securityContact); + message.details !== undefined && (obj.details = message.details); + return obj; + }, + fromPartial(object: DeepPartial): Description { const message = { ...baseDescription } as Description; if (object.moniker !== undefined && object.moniker !== null) { @@ -591,16 +617,6 @@ export const Description = { } return message; }, - - toJSON(message: Description): unknown { - const obj: any = {}; - message.moniker !== undefined && (obj.moniker = message.moniker); - message.identity !== undefined && (obj.identity = message.identity); - message.website !== undefined && (obj.website = message.website); - message.securityContact !== undefined && (obj.securityContact = message.securityContact); - message.details !== undefined && (obj.details = message.details); - return obj; - }, }; const baseValidator: object = { @@ -615,32 +631,46 @@ const baseValidator: object = { export const Validator = { encode(message: Validator, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.operatorAddress); + if (message.operatorAddress !== "") { + writer.uint32(10).string(message.operatorAddress); + } if (message.consensusPubkey !== undefined) { Any.encode(message.consensusPubkey, writer.uint32(18).fork()).ldelim(); } - writer.uint32(24).bool(message.jailed); - writer.uint32(32).int32(message.status); - writer.uint32(42).string(message.tokens); - writer.uint32(50).string(message.delegatorShares); + if (message.jailed === true) { + writer.uint32(24).bool(message.jailed); + } + if (message.status !== 0) { + writer.uint32(32).int32(message.status); + } + if (message.tokens !== "") { + writer.uint32(42).string(message.tokens); + } + if (message.delegatorShares !== "") { + writer.uint32(50).string(message.delegatorShares); + } if (message.description !== undefined) { Description.encode(message.description, writer.uint32(58).fork()).ldelim(); } - writer.uint32(64).int64(message.unbondingHeight); + if (!message.unbondingHeight.isZero()) { + writer.uint32(64).int64(message.unbondingHeight); + } if (message.unbondingTime !== undefined) { Timestamp.encode(toTimestamp(message.unbondingTime), writer.uint32(74).fork()).ldelim(); } if (message.commission !== undefined) { Commission.encode(message.commission, writer.uint32(82).fork()).ldelim(); } - writer.uint32(90).string(message.minSelfDelegation); + if (message.minSelfDelegation !== "") { + writer.uint32(90).string(message.minSelfDelegation); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): Validator { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseValidator) as Validator; + const message = { ...baseValidator } as Validator; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -686,7 +716,7 @@ export const Validator = { }, fromJSON(object: any): Validator { - const message = Object.create(baseValidator) as Validator; + const message = { ...baseValidator } as Validator; if (object.operatorAddress !== undefined && object.operatorAddress !== null) { message.operatorAddress = String(object.operatorAddress); } else { @@ -745,6 +775,27 @@ export const Validator = { return message; }, + toJSON(message: Validator): unknown { + const obj: any = {}; + message.operatorAddress !== undefined && (obj.operatorAddress = message.operatorAddress); + message.consensusPubkey !== undefined && + (obj.consensusPubkey = message.consensusPubkey ? Any.toJSON(message.consensusPubkey) : undefined); + message.jailed !== undefined && (obj.jailed = message.jailed); + message.status !== undefined && (obj.status = bondStatusToJSON(message.status)); + message.tokens !== undefined && (obj.tokens = message.tokens); + message.delegatorShares !== undefined && (obj.delegatorShares = message.delegatorShares); + message.description !== undefined && + (obj.description = message.description ? Description.toJSON(message.description) : undefined); + message.unbondingHeight !== undefined && + (obj.unbondingHeight = (message.unbondingHeight || Long.ZERO).toString()); + message.unbondingTime !== undefined && + (obj.unbondingTime = message.unbondingTime !== undefined ? message.unbondingTime.toISOString() : null); + message.commission !== undefined && + (obj.commission = message.commission ? Commission.toJSON(message.commission) : undefined); + message.minSelfDelegation !== undefined && (obj.minSelfDelegation = message.minSelfDelegation); + return obj; + }, + fromPartial(object: DeepPartial): Validator { const message = { ...baseValidator } as Validator; if (object.operatorAddress !== undefined && object.operatorAddress !== null) { @@ -804,27 +855,6 @@ export const Validator = { } return message; }, - - toJSON(message: Validator): unknown { - const obj: any = {}; - message.operatorAddress !== undefined && (obj.operatorAddress = message.operatorAddress); - message.consensusPubkey !== undefined && - (obj.consensusPubkey = message.consensusPubkey ? Any.toJSON(message.consensusPubkey) : undefined); - message.jailed !== undefined && (obj.jailed = message.jailed); - message.status !== undefined && (obj.status = bondStatusToJSON(message.status)); - message.tokens !== undefined && (obj.tokens = message.tokens); - message.delegatorShares !== undefined && (obj.delegatorShares = message.delegatorShares); - message.description !== undefined && - (obj.description = message.description ? Description.toJSON(message.description) : undefined); - message.unbondingHeight !== undefined && - (obj.unbondingHeight = (message.unbondingHeight || Long.ZERO).toString()); - message.unbondingTime !== undefined && - (obj.unbondingTime = message.unbondingTime !== undefined ? message.unbondingTime.toISOString() : null); - message.commission !== undefined && - (obj.commission = message.commission ? Commission.toJSON(message.commission) : undefined); - message.minSelfDelegation !== undefined && (obj.minSelfDelegation = message.minSelfDelegation); - return obj; - }, }; const baseValAddresses: object = { addresses: "" }; @@ -840,7 +870,7 @@ export const ValAddresses = { decode(input: _m0.Reader | Uint8Array, length?: number): ValAddresses { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseValAddresses) as ValAddresses; + const message = { ...baseValAddresses } as ValAddresses; message.addresses = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -857,22 +887,11 @@ export const ValAddresses = { }, fromJSON(object: any): ValAddresses { - const message = Object.create(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; - }, - - 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); + message.addresses.push(String(e)); } } return message; @@ -887,21 +906,36 @@ 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); + } + } + return message; + }, }; const baseDVPair: object = { delegatorAddress: "", validatorAddress: "" }; export const DVPair = { encode(message: DVPair, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.delegatorAddress); - writer.uint32(18).string(message.validatorAddress); + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): DVPair { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseDVPair) as DVPair; + const message = { ...baseDVPair } as DVPair; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -920,7 +954,7 @@ export const DVPair = { }, fromJSON(object: any): DVPair { - const message = Object.create(baseDVPair) as DVPair; + const message = { ...baseDVPair } as DVPair; if (object.delegatorAddress !== undefined && object.delegatorAddress !== null) { message.delegatorAddress = String(object.delegatorAddress); } else { @@ -934,6 +968,13 @@ export const DVPair = { return message; }, + toJSON(message: DVPair): unknown { + const obj: any = {}; + message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); + message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); + return obj; + }, + fromPartial(object: DeepPartial): DVPair { const message = { ...baseDVPair } as DVPair; if (object.delegatorAddress !== undefined && object.delegatorAddress !== null) { @@ -948,13 +989,6 @@ export const DVPair = { } return message; }, - - toJSON(message: DVPair): unknown { - const obj: any = {}; - message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); - message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); - return obj; - }, }; const baseDVPairs: object = {}; @@ -970,7 +1004,7 @@ export const DVPairs = { decode(input: _m0.Reader | Uint8Array, length?: number): DVPairs { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseDVPairs) as DVPairs; + const message = { ...baseDVPairs } as DVPairs; message.pairs = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -987,22 +1021,11 @@ export const DVPairs = { }, fromJSON(object: any): DVPairs { - const message = Object.create(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; - }, - - 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)); + message.pairs.push(DVPair.fromJSON(e)); } } return message; @@ -1017,22 +1040,39 @@ 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)); + } + } + return message; + }, }; const baseDVVTriplet: object = { delegatorAddress: "", validatorSrcAddress: "", validatorDstAddress: "" }; export const DVVTriplet = { encode(message: DVVTriplet, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.delegatorAddress); - writer.uint32(18).string(message.validatorSrcAddress); - writer.uint32(26).string(message.validatorDstAddress); + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorSrcAddress !== "") { + writer.uint32(18).string(message.validatorSrcAddress); + } + if (message.validatorDstAddress !== "") { + writer.uint32(26).string(message.validatorDstAddress); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): DVVTriplet { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseDVVTriplet) as DVVTriplet; + const message = { ...baseDVVTriplet } as DVVTriplet; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1054,7 +1094,7 @@ export const DVVTriplet = { }, fromJSON(object: any): DVVTriplet { - const message = Object.create(baseDVVTriplet) as DVVTriplet; + const message = { ...baseDVVTriplet } as DVVTriplet; if (object.delegatorAddress !== undefined && object.delegatorAddress !== null) { message.delegatorAddress = String(object.delegatorAddress); } else { @@ -1073,6 +1113,14 @@ export const DVVTriplet = { return message; }, + toJSON(message: DVVTriplet): unknown { + const obj: any = {}; + message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); + message.validatorSrcAddress !== undefined && (obj.validatorSrcAddress = message.validatorSrcAddress); + message.validatorDstAddress !== undefined && (obj.validatorDstAddress = message.validatorDstAddress); + return obj; + }, + fromPartial(object: DeepPartial): DVVTriplet { const message = { ...baseDVVTriplet } as DVVTriplet; if (object.delegatorAddress !== undefined && object.delegatorAddress !== null) { @@ -1092,14 +1140,6 @@ export const DVVTriplet = { } return message; }, - - toJSON(message: DVVTriplet): unknown { - const obj: any = {}; - message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); - message.validatorSrcAddress !== undefined && (obj.validatorSrcAddress = message.validatorSrcAddress); - message.validatorDstAddress !== undefined && (obj.validatorDstAddress = message.validatorDstAddress); - return obj; - }, }; const baseDVVTriplets: object = {}; @@ -1115,7 +1155,7 @@ export const DVVTriplets = { decode(input: _m0.Reader | Uint8Array, length?: number): DVVTriplets { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseDVVTriplets) as DVVTriplets; + const message = { ...baseDVVTriplets } as DVVTriplets; message.triplets = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -1132,22 +1172,11 @@ export const DVVTriplets = { }, fromJSON(object: any): DVVTriplets { - const message = Object.create(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; - }, - - 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)); + message.triplets.push(DVVTriplet.fromJSON(e)); } } return message; @@ -1162,22 +1191,39 @@ 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)); + } + } + return message; + }, }; const baseDelegation: object = { delegatorAddress: "", validatorAddress: "", shares: "" }; export const Delegation = { encode(message: Delegation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.delegatorAddress); - writer.uint32(18).string(message.validatorAddress); - writer.uint32(26).string(message.shares); + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.shares !== "") { + writer.uint32(26).string(message.shares); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): Delegation { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseDelegation) as Delegation; + const message = { ...baseDelegation } as Delegation; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1199,7 +1245,7 @@ export const Delegation = { }, fromJSON(object: any): Delegation { - const message = Object.create(baseDelegation) as Delegation; + const message = { ...baseDelegation } as Delegation; if (object.delegatorAddress !== undefined && object.delegatorAddress !== null) { message.delegatorAddress = String(object.delegatorAddress); } else { @@ -1218,6 +1264,14 @@ export const Delegation = { return message; }, + toJSON(message: Delegation): unknown { + const obj: any = {}; + message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); + message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); + message.shares !== undefined && (obj.shares = message.shares); + return obj; + }, + fromPartial(object: DeepPartial): Delegation { const message = { ...baseDelegation } as Delegation; if (object.delegatorAddress !== undefined && object.delegatorAddress !== null) { @@ -1237,22 +1291,18 @@ export const Delegation = { } return message; }, - - toJSON(message: Delegation): unknown { - const obj: any = {}; - message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); - message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); - message.shares !== undefined && (obj.shares = message.shares); - return obj; - }, }; const baseUnbondingDelegation: object = { delegatorAddress: "", validatorAddress: "" }; export const UnbondingDelegation = { encode(message: UnbondingDelegation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.delegatorAddress); - writer.uint32(18).string(message.validatorAddress); + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } for (const v of message.entries) { UnbondingDelegationEntry.encode(v!, writer.uint32(26).fork()).ldelim(); } @@ -1262,7 +1312,7 @@ export const UnbondingDelegation = { decode(input: _m0.Reader | Uint8Array, length?: number): UnbondingDelegation { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseUnbondingDelegation) as UnbondingDelegation; + const message = { ...baseUnbondingDelegation } as UnbondingDelegation; message.entries = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -1285,7 +1335,7 @@ export const UnbondingDelegation = { }, fromJSON(object: any): UnbondingDelegation { - const message = Object.create(baseUnbondingDelegation) as UnbondingDelegation; + const message = { ...baseUnbondingDelegation } as UnbondingDelegation; message.entries = []; if (object.delegatorAddress !== undefined && object.delegatorAddress !== null) { message.delegatorAddress = String(object.delegatorAddress); @@ -1305,6 +1355,18 @@ export const UnbondingDelegation = { return message; }, + toJSON(message: UnbondingDelegation): unknown { + const obj: any = {}; + message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); + message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); + if (message.entries) { + obj.entries = message.entries.map((e) => (e ? UnbondingDelegationEntry.toJSON(e) : undefined)); + } else { + obj.entries = []; + } + return obj; + }, + fromPartial(object: DeepPartial): UnbondingDelegation { const message = { ...baseUnbondingDelegation } as UnbondingDelegation; message.entries = []; @@ -1325,37 +1387,31 @@ export const UnbondingDelegation = { } return message; }, - - toJSON(message: UnbondingDelegation): unknown { - const obj: any = {}; - message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); - message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); - if (message.entries) { - obj.entries = message.entries.map((e) => (e ? UnbondingDelegationEntry.toJSON(e) : undefined)); - } else { - obj.entries = []; - } - return obj; - }, }; const baseUnbondingDelegationEntry: object = { creationHeight: Long.ZERO, initialBalance: "", balance: "" }; export const UnbondingDelegationEntry = { encode(message: UnbondingDelegationEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).int64(message.creationHeight); + if (!message.creationHeight.isZero()) { + writer.uint32(8).int64(message.creationHeight); + } if (message.completionTime !== undefined) { Timestamp.encode(toTimestamp(message.completionTime), writer.uint32(18).fork()).ldelim(); } - writer.uint32(26).string(message.initialBalance); - writer.uint32(34).string(message.balance); + if (message.initialBalance !== "") { + writer.uint32(26).string(message.initialBalance); + } + if (message.balance !== "") { + writer.uint32(34).string(message.balance); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): UnbondingDelegationEntry { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseUnbondingDelegationEntry) as UnbondingDelegationEntry; + const message = { ...baseUnbondingDelegationEntry } as UnbondingDelegationEntry; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1380,7 +1436,7 @@ export const UnbondingDelegationEntry = { }, fromJSON(object: any): UnbondingDelegationEntry { - const message = Object.create(baseUnbondingDelegationEntry) as UnbondingDelegationEntry; + const message = { ...baseUnbondingDelegationEntry } as UnbondingDelegationEntry; if (object.creationHeight !== undefined && object.creationHeight !== null) { message.creationHeight = Long.fromString(object.creationHeight); } else { @@ -1404,6 +1460,18 @@ export const UnbondingDelegationEntry = { return message; }, + toJSON(message: UnbondingDelegationEntry): unknown { + const obj: any = {}; + message.creationHeight !== undefined && + (obj.creationHeight = (message.creationHeight || Long.ZERO).toString()); + message.completionTime !== undefined && + (obj.completionTime = + message.completionTime !== undefined ? message.completionTime.toISOString() : null); + message.initialBalance !== undefined && (obj.initialBalance = message.initialBalance); + message.balance !== undefined && (obj.balance = message.balance); + return obj; + }, + fromPartial(object: DeepPartial): UnbondingDelegationEntry { const message = { ...baseUnbondingDelegationEntry } as UnbondingDelegationEntry; if (object.creationHeight !== undefined && object.creationHeight !== null) { @@ -1428,37 +1496,31 @@ export const UnbondingDelegationEntry = { } return message; }, - - toJSON(message: UnbondingDelegationEntry): unknown { - const obj: any = {}; - message.creationHeight !== undefined && - (obj.creationHeight = (message.creationHeight || Long.ZERO).toString()); - message.completionTime !== undefined && - (obj.completionTime = - message.completionTime !== undefined ? message.completionTime.toISOString() : null); - message.initialBalance !== undefined && (obj.initialBalance = message.initialBalance); - message.balance !== undefined && (obj.balance = message.balance); - return obj; - }, }; const baseRedelegationEntry: object = { creationHeight: Long.ZERO, initialBalance: "", sharesDst: "" }; export const RedelegationEntry = { encode(message: RedelegationEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).int64(message.creationHeight); + if (!message.creationHeight.isZero()) { + writer.uint32(8).int64(message.creationHeight); + } if (message.completionTime !== undefined) { Timestamp.encode(toTimestamp(message.completionTime), writer.uint32(18).fork()).ldelim(); } - writer.uint32(26).string(message.initialBalance); - writer.uint32(34).string(message.sharesDst); + if (message.initialBalance !== "") { + writer.uint32(26).string(message.initialBalance); + } + if (message.sharesDst !== "") { + writer.uint32(34).string(message.sharesDst); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): RedelegationEntry { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseRedelegationEntry) as RedelegationEntry; + const message = { ...baseRedelegationEntry } as RedelegationEntry; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1483,7 +1545,7 @@ export const RedelegationEntry = { }, fromJSON(object: any): RedelegationEntry { - const message = Object.create(baseRedelegationEntry) as RedelegationEntry; + const message = { ...baseRedelegationEntry } as RedelegationEntry; if (object.creationHeight !== undefined && object.creationHeight !== null) { message.creationHeight = Long.fromString(object.creationHeight); } else { @@ -1507,6 +1569,18 @@ export const RedelegationEntry = { return message; }, + toJSON(message: RedelegationEntry): unknown { + const obj: any = {}; + message.creationHeight !== undefined && + (obj.creationHeight = (message.creationHeight || Long.ZERO).toString()); + message.completionTime !== undefined && + (obj.completionTime = + message.completionTime !== undefined ? message.completionTime.toISOString() : null); + message.initialBalance !== undefined && (obj.initialBalance = message.initialBalance); + message.sharesDst !== undefined && (obj.sharesDst = message.sharesDst); + return obj; + }, + fromPartial(object: DeepPartial): RedelegationEntry { const message = { ...baseRedelegationEntry } as RedelegationEntry; if (object.creationHeight !== undefined && object.creationHeight !== null) { @@ -1531,27 +1605,21 @@ export const RedelegationEntry = { } return message; }, - - toJSON(message: RedelegationEntry): unknown { - const obj: any = {}; - message.creationHeight !== undefined && - (obj.creationHeight = (message.creationHeight || Long.ZERO).toString()); - message.completionTime !== undefined && - (obj.completionTime = - message.completionTime !== undefined ? message.completionTime.toISOString() : null); - message.initialBalance !== undefined && (obj.initialBalance = message.initialBalance); - message.sharesDst !== undefined && (obj.sharesDst = message.sharesDst); - return obj; - }, }; const baseRedelegation: object = { delegatorAddress: "", validatorSrcAddress: "", validatorDstAddress: "" }; export const Redelegation = { encode(message: Redelegation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.delegatorAddress); - writer.uint32(18).string(message.validatorSrcAddress); - writer.uint32(26).string(message.validatorDstAddress); + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorSrcAddress !== "") { + writer.uint32(18).string(message.validatorSrcAddress); + } + if (message.validatorDstAddress !== "") { + writer.uint32(26).string(message.validatorDstAddress); + } for (const v of message.entries) { RedelegationEntry.encode(v!, writer.uint32(34).fork()).ldelim(); } @@ -1561,7 +1629,7 @@ export const Redelegation = { decode(input: _m0.Reader | Uint8Array, length?: number): Redelegation { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseRedelegation) as Redelegation; + const message = { ...baseRedelegation } as Redelegation; message.entries = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -1587,7 +1655,7 @@ export const Redelegation = { }, fromJSON(object: any): Redelegation { - const message = Object.create(baseRedelegation) as Redelegation; + const message = { ...baseRedelegation } as Redelegation; message.entries = []; if (object.delegatorAddress !== undefined && object.delegatorAddress !== null) { message.delegatorAddress = String(object.delegatorAddress); @@ -1612,6 +1680,19 @@ export const Redelegation = { return message; }, + toJSON(message: Redelegation): unknown { + const obj: any = {}; + message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); + message.validatorSrcAddress !== undefined && (obj.validatorSrcAddress = message.validatorSrcAddress); + message.validatorDstAddress !== undefined && (obj.validatorDstAddress = message.validatorDstAddress); + if (message.entries) { + obj.entries = message.entries.map((e) => (e ? RedelegationEntry.toJSON(e) : undefined)); + } else { + obj.entries = []; + } + return obj; + }, + fromPartial(object: DeepPartial): Redelegation { const message = { ...baseRedelegation } as Redelegation; message.entries = []; @@ -1637,19 +1718,6 @@ export const Redelegation = { } return message; }, - - toJSON(message: Redelegation): unknown { - const obj: any = {}; - message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); - message.validatorSrcAddress !== undefined && (obj.validatorSrcAddress = message.validatorSrcAddress); - message.validatorDstAddress !== undefined && (obj.validatorDstAddress = message.validatorDstAddress); - if (message.entries) { - obj.entries = message.entries.map((e) => (e ? RedelegationEntry.toJSON(e) : undefined)); - } else { - obj.entries = []; - } - return obj; - }, }; const baseParams: object = { maxValidators: 0, maxEntries: 0, historicalEntries: 0, bondDenom: "" }; @@ -1659,17 +1727,25 @@ export const Params = { if (message.unbondingTime !== undefined) { Duration.encode(message.unbondingTime, writer.uint32(10).fork()).ldelim(); } - writer.uint32(16).uint32(message.maxValidators); - writer.uint32(24).uint32(message.maxEntries); - writer.uint32(32).uint32(message.historicalEntries); - writer.uint32(42).string(message.bondDenom); + if (message.maxValidators !== 0) { + writer.uint32(16).uint32(message.maxValidators); + } + if (message.maxEntries !== 0) { + writer.uint32(24).uint32(message.maxEntries); + } + if (message.historicalEntries !== 0) { + writer.uint32(32).uint32(message.historicalEntries); + } + if (message.bondDenom !== "") { + writer.uint32(42).string(message.bondDenom); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): Params { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseParams) as Params; + const message = { ...baseParams } as Params; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1697,7 +1773,7 @@ export const Params = { }, fromJSON(object: any): Params { - const message = Object.create(baseParams) as Params; + const message = { ...baseParams } as Params; if (object.unbondingTime !== undefined && object.unbondingTime !== null) { message.unbondingTime = Duration.fromJSON(object.unbondingTime); } else { @@ -1726,6 +1802,17 @@ export const Params = { return message; }, + 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.bondDenom !== undefined && (obj.bondDenom = message.bondDenom); + return obj; + }, + fromPartial(object: DeepPartial): Params { const message = { ...baseParams } as Params; if (object.unbondingTime !== undefined && object.unbondingTime !== null) { @@ -1755,17 +1842,6 @@ export const Params = { } return message; }, - - 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.bondDenom !== undefined && (obj.bondDenom = message.bondDenom); - return obj; - }, }; const baseDelegationResponse: object = {}; @@ -1784,7 +1860,7 @@ export const DelegationResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): DelegationResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseDelegationResponse) as DelegationResponse; + const message = { ...baseDelegationResponse } as DelegationResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1803,7 +1879,7 @@ export const DelegationResponse = { }, fromJSON(object: any): DelegationResponse { - const message = Object.create(baseDelegationResponse) as DelegationResponse; + const message = { ...baseDelegationResponse } as DelegationResponse; if (object.delegation !== undefined && object.delegation !== null) { message.delegation = Delegation.fromJSON(object.delegation); } else { @@ -1817,6 +1893,15 @@ export const DelegationResponse = { return message; }, + toJSON(message: DelegationResponse): unknown { + const obj: any = {}; + message.delegation !== undefined && + (obj.delegation = message.delegation ? Delegation.toJSON(message.delegation) : undefined); + message.balance !== undefined && + (obj.balance = message.balance ? Coin.toJSON(message.balance) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): DelegationResponse { const message = { ...baseDelegationResponse } as DelegationResponse; if (object.delegation !== undefined && object.delegation !== null) { @@ -1831,15 +1916,6 @@ export const DelegationResponse = { } return message; }, - - toJSON(message: DelegationResponse): unknown { - const obj: any = {}; - message.delegation !== undefined && - (obj.delegation = message.delegation ? Delegation.toJSON(message.delegation) : undefined); - message.balance !== undefined && - (obj.balance = message.balance ? Coin.toJSON(message.balance) : undefined); - return obj; - }, }; const baseRedelegationEntryResponse: object = { balance: "" }; @@ -1849,14 +1925,16 @@ export const RedelegationEntryResponse = { if (message.redelegationEntry !== undefined) { RedelegationEntry.encode(message.redelegationEntry, writer.uint32(10).fork()).ldelim(); } - writer.uint32(34).string(message.balance); + if (message.balance !== "") { + writer.uint32(34).string(message.balance); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): RedelegationEntryResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseRedelegationEntryResponse) as RedelegationEntryResponse; + const message = { ...baseRedelegationEntryResponse } as RedelegationEntryResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1875,7 +1953,7 @@ export const RedelegationEntryResponse = { }, fromJSON(object: any): RedelegationEntryResponse { - const message = Object.create(baseRedelegationEntryResponse) as RedelegationEntryResponse; + const message = { ...baseRedelegationEntryResponse } as RedelegationEntryResponse; if (object.redelegationEntry !== undefined && object.redelegationEntry !== null) { message.redelegationEntry = RedelegationEntry.fromJSON(object.redelegationEntry); } else { @@ -1889,6 +1967,16 @@ export const RedelegationEntryResponse = { return message; }, + toJSON(message: RedelegationEntryResponse): unknown { + const obj: any = {}; + message.redelegationEntry !== undefined && + (obj.redelegationEntry = message.redelegationEntry + ? RedelegationEntry.toJSON(message.redelegationEntry) + : undefined); + message.balance !== undefined && (obj.balance = message.balance); + return obj; + }, + fromPartial(object: DeepPartial): RedelegationEntryResponse { const message = { ...baseRedelegationEntryResponse } as RedelegationEntryResponse; if (object.redelegationEntry !== undefined && object.redelegationEntry !== null) { @@ -1903,16 +1991,6 @@ export const RedelegationEntryResponse = { } return message; }, - - toJSON(message: RedelegationEntryResponse): unknown { - const obj: any = {}; - message.redelegationEntry !== undefined && - (obj.redelegationEntry = message.redelegationEntry - ? RedelegationEntry.toJSON(message.redelegationEntry) - : undefined); - message.balance !== undefined && (obj.balance = message.balance); - return obj; - }, }; const baseRedelegationResponse: object = {}; @@ -1931,7 +2009,7 @@ export const RedelegationResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): RedelegationResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseRedelegationResponse) as RedelegationResponse; + const message = { ...baseRedelegationResponse } as RedelegationResponse; message.entries = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -1951,7 +2029,7 @@ export const RedelegationResponse = { }, fromJSON(object: any): RedelegationResponse { - const message = Object.create(baseRedelegationResponse) as RedelegationResponse; + const message = { ...baseRedelegationResponse } as RedelegationResponse; message.entries = []; if (object.redelegation !== undefined && object.redelegation !== null) { message.redelegation = Redelegation.fromJSON(object.redelegation); @@ -1966,6 +2044,18 @@ export const RedelegationResponse = { return message; }, + toJSON(message: RedelegationResponse): unknown { + const obj: any = {}; + message.redelegation !== undefined && + (obj.redelegation = message.redelegation ? Redelegation.toJSON(message.redelegation) : undefined); + if (message.entries) { + obj.entries = message.entries.map((e) => (e ? RedelegationEntryResponse.toJSON(e) : undefined)); + } else { + obj.entries = []; + } + return obj; + }, + fromPartial(object: DeepPartial): RedelegationResponse { const message = { ...baseRedelegationResponse } as RedelegationResponse; message.entries = []; @@ -1981,33 +2071,25 @@ export const RedelegationResponse = { } return message; }, - - toJSON(message: RedelegationResponse): unknown { - const obj: any = {}; - message.redelegation !== undefined && - (obj.redelegation = message.redelegation ? Redelegation.toJSON(message.redelegation) : undefined); - if (message.entries) { - obj.entries = message.entries.map((e) => (e ? RedelegationEntryResponse.toJSON(e) : undefined)); - } else { - obj.entries = []; - } - return obj; - }, }; const basePool: object = { notBondedTokens: "", bondedTokens: "" }; export const Pool = { encode(message: Pool, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.notBondedTokens); - writer.uint32(18).string(message.bondedTokens); + if (message.notBondedTokens !== "") { + writer.uint32(10).string(message.notBondedTokens); + } + if (message.bondedTokens !== "") { + writer.uint32(18).string(message.bondedTokens); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): Pool { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(basePool) as Pool; + const message = { ...basePool } as Pool; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -2026,7 +2108,7 @@ export const Pool = { }, fromJSON(object: any): Pool { - const message = Object.create(basePool) as Pool; + const message = { ...basePool } as Pool; if (object.notBondedTokens !== undefined && object.notBondedTokens !== null) { message.notBondedTokens = String(object.notBondedTokens); } else { @@ -2040,6 +2122,13 @@ export const Pool = { return message; }, + toJSON(message: Pool): unknown { + const obj: any = {}; + message.notBondedTokens !== undefined && (obj.notBondedTokens = message.notBondedTokens); + message.bondedTokens !== undefined && (obj.bondedTokens = message.bondedTokens); + return obj; + }, + fromPartial(object: DeepPartial): Pool { const message = { ...basePool } as Pool; if (object.notBondedTokens !== undefined && object.notBondedTokens !== null) { @@ -2054,13 +2143,6 @@ export const Pool = { } return message; }, - - toJSON(message: Pool): unknown { - const obj: any = {}; - message.notBondedTokens !== undefined && (obj.notBondedTokens = message.notBondedTokens); - message.bondedTokens !== undefined && (obj.bondedTokens = message.bondedTokens); - return obj; - }, }; type Builtin = Date | Function | Uint8Array | string | number | undefined | Long; diff --git a/packages/stargate/src/codec/cosmos/staking/v1beta1/tx.ts b/packages/stargate/src/codec/cosmos/staking/v1beta1/tx.ts index ddd702cd..662f5b36 100644 --- a/packages/stargate/src/codec/cosmos/staking/v1beta1/tx.ts +++ b/packages/stargate/src/codec/cosmos/staking/v1beta1/tx.ts @@ -93,9 +93,15 @@ export const MsgCreateValidator = { if (message.commission !== undefined) { CommissionRates.encode(message.commission, writer.uint32(18).fork()).ldelim(); } - writer.uint32(26).string(message.minSelfDelegation); - writer.uint32(34).string(message.delegatorAddress); - writer.uint32(42).string(message.validatorAddress); + if (message.minSelfDelegation !== "") { + writer.uint32(26).string(message.minSelfDelegation); + } + if (message.delegatorAddress !== "") { + writer.uint32(34).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(42).string(message.validatorAddress); + } if (message.pubkey !== undefined) { Any.encode(message.pubkey, writer.uint32(50).fork()).ldelim(); } @@ -108,7 +114,7 @@ export const MsgCreateValidator = { decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateValidator { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseMsgCreateValidator) as MsgCreateValidator; + const message = { ...baseMsgCreateValidator } as MsgCreateValidator; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -142,7 +148,7 @@ export const MsgCreateValidator = { }, fromJSON(object: any): MsgCreateValidator { - const message = Object.create(baseMsgCreateValidator) as MsgCreateValidator; + const message = { ...baseMsgCreateValidator } as MsgCreateValidator; if (object.description !== undefined && object.description !== null) { message.description = Description.fromJSON(object.description); } else { @@ -181,6 +187,20 @@ export const MsgCreateValidator = { return message; }, + toJSON(message: MsgCreateValidator): unknown { + const obj: any = {}; + message.description !== undefined && + (obj.description = message.description ? Description.toJSON(message.description) : undefined); + message.commission !== undefined && + (obj.commission = message.commission ? CommissionRates.toJSON(message.commission) : undefined); + message.minSelfDelegation !== undefined && (obj.minSelfDelegation = message.minSelfDelegation); + message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); + message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); + message.value !== undefined && (obj.value = message.value ? Coin.toJSON(message.value) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): MsgCreateValidator { const message = { ...baseMsgCreateValidator } as MsgCreateValidator; if (object.description !== undefined && object.description !== null) { @@ -220,20 +240,6 @@ export const MsgCreateValidator = { } return message; }, - - toJSON(message: MsgCreateValidator): unknown { - const obj: any = {}; - message.description !== undefined && - (obj.description = message.description ? Description.toJSON(message.description) : undefined); - message.commission !== undefined && - (obj.commission = message.commission ? CommissionRates.toJSON(message.commission) : undefined); - message.minSelfDelegation !== undefined && (obj.minSelfDelegation = message.minSelfDelegation); - message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); - message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); - message.value !== undefined && (obj.value = message.value ? Coin.toJSON(message.value) : undefined); - return obj; - }, }; const baseMsgCreateValidatorResponse: object = {}; @@ -246,7 +252,7 @@ export const MsgCreateValidatorResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateValidatorResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseMsgCreateValidatorResponse) as MsgCreateValidatorResponse; + const message = { ...baseMsgCreateValidatorResponse } as MsgCreateValidatorResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -259,11 +265,6 @@ export const MsgCreateValidatorResponse = { }, fromJSON(_: any): MsgCreateValidatorResponse { - const message = Object.create(baseMsgCreateValidatorResponse) as MsgCreateValidatorResponse; - return message; - }, - - fromPartial(_: DeepPartial): MsgCreateValidatorResponse { const message = { ...baseMsgCreateValidatorResponse } as MsgCreateValidatorResponse; return message; }, @@ -272,6 +273,11 @@ export const MsgCreateValidatorResponse = { const obj: any = {}; return obj; }, + + fromPartial(_: DeepPartial): MsgCreateValidatorResponse { + const message = { ...baseMsgCreateValidatorResponse } as MsgCreateValidatorResponse; + return message; + }, }; const baseMsgEditValidator: object = { validatorAddress: "", commissionRate: "", minSelfDelegation: "" }; @@ -281,16 +287,22 @@ export const MsgEditValidator = { if (message.description !== undefined) { Description.encode(message.description, writer.uint32(10).fork()).ldelim(); } - writer.uint32(18).string(message.validatorAddress); - writer.uint32(26).string(message.commissionRate); - writer.uint32(34).string(message.minSelfDelegation); + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.commissionRate !== "") { + writer.uint32(26).string(message.commissionRate); + } + if (message.minSelfDelegation !== "") { + writer.uint32(34).string(message.minSelfDelegation); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgEditValidator { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseMsgEditValidator) as MsgEditValidator; + const message = { ...baseMsgEditValidator } as MsgEditValidator; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -315,7 +327,7 @@ export const MsgEditValidator = { }, fromJSON(object: any): MsgEditValidator { - const message = Object.create(baseMsgEditValidator) as MsgEditValidator; + const message = { ...baseMsgEditValidator } as MsgEditValidator; if (object.description !== undefined && object.description !== null) { message.description = Description.fromJSON(object.description); } else { @@ -339,6 +351,16 @@ export const MsgEditValidator = { return message; }, + toJSON(message: MsgEditValidator): unknown { + const obj: any = {}; + message.description !== undefined && + (obj.description = message.description ? Description.toJSON(message.description) : undefined); + message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); + message.commissionRate !== undefined && (obj.commissionRate = message.commissionRate); + message.minSelfDelegation !== undefined && (obj.minSelfDelegation = message.minSelfDelegation); + return obj; + }, + fromPartial(object: DeepPartial): MsgEditValidator { const message = { ...baseMsgEditValidator } as MsgEditValidator; if (object.description !== undefined && object.description !== null) { @@ -363,16 +385,6 @@ export const MsgEditValidator = { } return message; }, - - toJSON(message: MsgEditValidator): unknown { - const obj: any = {}; - message.description !== undefined && - (obj.description = message.description ? Description.toJSON(message.description) : undefined); - message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); - message.commissionRate !== undefined && (obj.commissionRate = message.commissionRate); - message.minSelfDelegation !== undefined && (obj.minSelfDelegation = message.minSelfDelegation); - return obj; - }, }; const baseMsgEditValidatorResponse: object = {}; @@ -385,7 +397,7 @@ export const MsgEditValidatorResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): MsgEditValidatorResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseMsgEditValidatorResponse) as MsgEditValidatorResponse; + const message = { ...baseMsgEditValidatorResponse } as MsgEditValidatorResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -398,11 +410,6 @@ export const MsgEditValidatorResponse = { }, fromJSON(_: any): MsgEditValidatorResponse { - const message = Object.create(baseMsgEditValidatorResponse) as MsgEditValidatorResponse; - return message; - }, - - fromPartial(_: DeepPartial): MsgEditValidatorResponse { const message = { ...baseMsgEditValidatorResponse } as MsgEditValidatorResponse; return message; }, @@ -411,14 +418,23 @@ export const MsgEditValidatorResponse = { const obj: any = {}; return obj; }, + + fromPartial(_: DeepPartial): MsgEditValidatorResponse { + const message = { ...baseMsgEditValidatorResponse } as MsgEditValidatorResponse; + return message; + }, }; const baseMsgDelegate: object = { delegatorAddress: "", validatorAddress: "" }; export const MsgDelegate = { encode(message: MsgDelegate, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.delegatorAddress); - writer.uint32(18).string(message.validatorAddress); + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } if (message.amount !== undefined) { Coin.encode(message.amount, writer.uint32(26).fork()).ldelim(); } @@ -428,7 +444,7 @@ export const MsgDelegate = { decode(input: _m0.Reader | Uint8Array, length?: number): MsgDelegate { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseMsgDelegate) as MsgDelegate; + const message = { ...baseMsgDelegate } as MsgDelegate; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -450,7 +466,7 @@ export const MsgDelegate = { }, fromJSON(object: any): MsgDelegate { - const message = Object.create(baseMsgDelegate) as MsgDelegate; + const message = { ...baseMsgDelegate } as MsgDelegate; if (object.delegatorAddress !== undefined && object.delegatorAddress !== null) { message.delegatorAddress = String(object.delegatorAddress); } else { @@ -469,6 +485,14 @@ export const MsgDelegate = { return message; }, + toJSON(message: MsgDelegate): unknown { + const obj: any = {}; + message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); + message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); + message.amount !== undefined && (obj.amount = message.amount ? Coin.toJSON(message.amount) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): MsgDelegate { const message = { ...baseMsgDelegate } as MsgDelegate; if (object.delegatorAddress !== undefined && object.delegatorAddress !== null) { @@ -488,14 +512,6 @@ export const MsgDelegate = { } return message; }, - - toJSON(message: MsgDelegate): unknown { - const obj: any = {}; - message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); - message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); - message.amount !== undefined && (obj.amount = message.amount ? Coin.toJSON(message.amount) : undefined); - return obj; - }, }; const baseMsgDelegateResponse: object = {}; @@ -508,7 +524,7 @@ export const MsgDelegateResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): MsgDelegateResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseMsgDelegateResponse) as MsgDelegateResponse; + const message = { ...baseMsgDelegateResponse } as MsgDelegateResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -521,11 +537,6 @@ export const MsgDelegateResponse = { }, fromJSON(_: any): MsgDelegateResponse { - const message = Object.create(baseMsgDelegateResponse) as MsgDelegateResponse; - return message; - }, - - fromPartial(_: DeepPartial): MsgDelegateResponse { const message = { ...baseMsgDelegateResponse } as MsgDelegateResponse; return message; }, @@ -534,6 +545,11 @@ export const MsgDelegateResponse = { const obj: any = {}; return obj; }, + + fromPartial(_: DeepPartial): MsgDelegateResponse { + const message = { ...baseMsgDelegateResponse } as MsgDelegateResponse; + return message; + }, }; const baseMsgBeginRedelegate: object = { @@ -544,9 +560,15 @@ const baseMsgBeginRedelegate: object = { export const MsgBeginRedelegate = { encode(message: MsgBeginRedelegate, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.delegatorAddress); - writer.uint32(18).string(message.validatorSrcAddress); - writer.uint32(26).string(message.validatorDstAddress); + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorSrcAddress !== "") { + writer.uint32(18).string(message.validatorSrcAddress); + } + if (message.validatorDstAddress !== "") { + writer.uint32(26).string(message.validatorDstAddress); + } if (message.amount !== undefined) { Coin.encode(message.amount, writer.uint32(34).fork()).ldelim(); } @@ -556,7 +578,7 @@ export const MsgBeginRedelegate = { decode(input: _m0.Reader | Uint8Array, length?: number): MsgBeginRedelegate { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseMsgBeginRedelegate) as MsgBeginRedelegate; + const message = { ...baseMsgBeginRedelegate } as MsgBeginRedelegate; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -581,7 +603,7 @@ export const MsgBeginRedelegate = { }, fromJSON(object: any): MsgBeginRedelegate { - const message = Object.create(baseMsgBeginRedelegate) as MsgBeginRedelegate; + const message = { ...baseMsgBeginRedelegate } as MsgBeginRedelegate; if (object.delegatorAddress !== undefined && object.delegatorAddress !== null) { message.delegatorAddress = String(object.delegatorAddress); } else { @@ -605,6 +627,15 @@ export const MsgBeginRedelegate = { return message; }, + toJSON(message: MsgBeginRedelegate): unknown { + const obj: any = {}; + message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); + message.validatorSrcAddress !== undefined && (obj.validatorSrcAddress = message.validatorSrcAddress); + message.validatorDstAddress !== undefined && (obj.validatorDstAddress = message.validatorDstAddress); + message.amount !== undefined && (obj.amount = message.amount ? Coin.toJSON(message.amount) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): MsgBeginRedelegate { const message = { ...baseMsgBeginRedelegate } as MsgBeginRedelegate; if (object.delegatorAddress !== undefined && object.delegatorAddress !== null) { @@ -629,15 +660,6 @@ export const MsgBeginRedelegate = { } return message; }, - - toJSON(message: MsgBeginRedelegate): unknown { - const obj: any = {}; - message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); - message.validatorSrcAddress !== undefined && (obj.validatorSrcAddress = message.validatorSrcAddress); - message.validatorDstAddress !== undefined && (obj.validatorDstAddress = message.validatorDstAddress); - message.amount !== undefined && (obj.amount = message.amount ? Coin.toJSON(message.amount) : undefined); - return obj; - }, }; const baseMsgBeginRedelegateResponse: object = {}; @@ -653,7 +675,7 @@ export const MsgBeginRedelegateResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): MsgBeginRedelegateResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseMsgBeginRedelegateResponse) as MsgBeginRedelegateResponse; + const message = { ...baseMsgBeginRedelegateResponse } as MsgBeginRedelegateResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -669,19 +691,9 @@ export const MsgBeginRedelegateResponse = { }, fromJSON(object: any): MsgBeginRedelegateResponse { - const message = Object.create(baseMsgBeginRedelegateResponse) as MsgBeginRedelegateResponse; - if (object.completionTime !== undefined && object.completionTime !== null) { - message.completionTime = fromJsonTimestamp(object.completionTime); - } else { - message.completionTime = undefined; - } - return message; - }, - - fromPartial(object: DeepPartial): MsgBeginRedelegateResponse { const message = { ...baseMsgBeginRedelegateResponse } as MsgBeginRedelegateResponse; if (object.completionTime !== undefined && object.completionTime !== null) { - message.completionTime = object.completionTime; + message.completionTime = fromJsonTimestamp(object.completionTime); } else { message.completionTime = undefined; } @@ -695,14 +707,28 @@ export const MsgBeginRedelegateResponse = { message.completionTime !== undefined ? message.completionTime.toISOString() : null); return obj; }, + + fromPartial(object: DeepPartial): MsgBeginRedelegateResponse { + const message = { ...baseMsgBeginRedelegateResponse } as MsgBeginRedelegateResponse; + if (object.completionTime !== undefined && object.completionTime !== null) { + message.completionTime = object.completionTime; + } else { + message.completionTime = undefined; + } + return message; + }, }; const baseMsgUndelegate: object = { delegatorAddress: "", validatorAddress: "" }; export const MsgUndelegate = { encode(message: MsgUndelegate, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.delegatorAddress); - writer.uint32(18).string(message.validatorAddress); + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } if (message.amount !== undefined) { Coin.encode(message.amount, writer.uint32(26).fork()).ldelim(); } @@ -712,7 +738,7 @@ export const MsgUndelegate = { decode(input: _m0.Reader | Uint8Array, length?: number): MsgUndelegate { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseMsgUndelegate) as MsgUndelegate; + const message = { ...baseMsgUndelegate } as MsgUndelegate; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -734,7 +760,7 @@ export const MsgUndelegate = { }, fromJSON(object: any): MsgUndelegate { - const message = Object.create(baseMsgUndelegate) as MsgUndelegate; + const message = { ...baseMsgUndelegate } as MsgUndelegate; if (object.delegatorAddress !== undefined && object.delegatorAddress !== null) { message.delegatorAddress = String(object.delegatorAddress); } else { @@ -753,6 +779,14 @@ export const MsgUndelegate = { return message; }, + toJSON(message: MsgUndelegate): unknown { + const obj: any = {}; + message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); + message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); + message.amount !== undefined && (obj.amount = message.amount ? Coin.toJSON(message.amount) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): MsgUndelegate { const message = { ...baseMsgUndelegate } as MsgUndelegate; if (object.delegatorAddress !== undefined && object.delegatorAddress !== null) { @@ -772,14 +806,6 @@ export const MsgUndelegate = { } return message; }, - - toJSON(message: MsgUndelegate): unknown { - const obj: any = {}; - message.delegatorAddress !== undefined && (obj.delegatorAddress = message.delegatorAddress); - message.validatorAddress !== undefined && (obj.validatorAddress = message.validatorAddress); - message.amount !== undefined && (obj.amount = message.amount ? Coin.toJSON(message.amount) : undefined); - return obj; - }, }; const baseMsgUndelegateResponse: object = {}; @@ -795,7 +821,7 @@ export const MsgUndelegateResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): MsgUndelegateResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseMsgUndelegateResponse) as MsgUndelegateResponse; + const message = { ...baseMsgUndelegateResponse } as MsgUndelegateResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -811,19 +837,9 @@ export const MsgUndelegateResponse = { }, fromJSON(object: any): MsgUndelegateResponse { - const message = Object.create(baseMsgUndelegateResponse) as MsgUndelegateResponse; - if (object.completionTime !== undefined && object.completionTime !== null) { - message.completionTime = fromJsonTimestamp(object.completionTime); - } else { - message.completionTime = undefined; - } - return message; - }, - - fromPartial(object: DeepPartial): MsgUndelegateResponse { const message = { ...baseMsgUndelegateResponse } as MsgUndelegateResponse; if (object.completionTime !== undefined && object.completionTime !== null) { - message.completionTime = object.completionTime; + message.completionTime = fromJsonTimestamp(object.completionTime); } else { message.completionTime = undefined; } @@ -837,6 +853,16 @@ export const MsgUndelegateResponse = { message.completionTime !== undefined ? message.completionTime.toISOString() : null); return obj; }, + + fromPartial(object: DeepPartial): MsgUndelegateResponse { + const message = { ...baseMsgUndelegateResponse } as MsgUndelegateResponse; + if (object.completionTime !== undefined && object.completionTime !== null) { + message.completionTime = object.completionTime; + } else { + message.completionTime = undefined; + } + return message; + }, }; /** Msg defines the staking Msg service. */ diff --git a/packages/stargate/src/codec/cosmos/tx/signing/v1beta1/signing.ts b/packages/stargate/src/codec/cosmos/tx/signing/v1beta1/signing.ts index a2fe89e7..e49a7573 100644 --- a/packages/stargate/src/codec/cosmos/tx/signing/v1beta1/signing.ts +++ b/packages/stargate/src/codec/cosmos/tx/signing/v1beta1/signing.ts @@ -129,7 +129,7 @@ export const SignatureDescriptors = { decode(input: _m0.Reader | Uint8Array, length?: number): SignatureDescriptors { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseSignatureDescriptors) as SignatureDescriptors; + const message = { ...baseSignatureDescriptors } as SignatureDescriptors; message.signatures = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -146,22 +146,11 @@ export const SignatureDescriptors = { }, fromJSON(object: any): SignatureDescriptors { - const message = Object.create(baseSignatureDescriptors) as SignatureDescriptors; - message.signatures = []; - if (object.signatures !== undefined && object.signatures !== null) { - for (const e of object.signatures) { - message.signatures.push(SignatureDescriptor.fromJSON(e)); - } - } - return message; - }, - - fromPartial(object: DeepPartial): SignatureDescriptors { const message = { ...baseSignatureDescriptors } as SignatureDescriptors; message.signatures = []; if (object.signatures !== undefined && object.signatures !== null) { for (const e of object.signatures) { - message.signatures.push(SignatureDescriptor.fromPartial(e)); + message.signatures.push(SignatureDescriptor.fromJSON(e)); } } return message; @@ -176,6 +165,17 @@ export const SignatureDescriptors = { } return obj; }, + + fromPartial(object: DeepPartial): SignatureDescriptors { + const message = { ...baseSignatureDescriptors } as SignatureDescriptors; + message.signatures = []; + if (object.signatures !== undefined && object.signatures !== null) { + for (const e of object.signatures) { + message.signatures.push(SignatureDescriptor.fromPartial(e)); + } + } + return message; + }, }; const baseSignatureDescriptor: object = { sequence: Long.UZERO }; @@ -188,14 +188,16 @@ export const SignatureDescriptor = { if (message.data !== undefined) { SignatureDescriptor_Data.encode(message.data, writer.uint32(18).fork()).ldelim(); } - writer.uint32(24).uint64(message.sequence); + if (!message.sequence.isZero()) { + writer.uint32(24).uint64(message.sequence); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): SignatureDescriptor { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseSignatureDescriptor) as SignatureDescriptor; + const message = { ...baseSignatureDescriptor } as SignatureDescriptor; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -217,7 +219,7 @@ export const SignatureDescriptor = { }, fromJSON(object: any): SignatureDescriptor { - const message = Object.create(baseSignatureDescriptor) as SignatureDescriptor; + const message = { ...baseSignatureDescriptor } as SignatureDescriptor; if (object.publicKey !== undefined && object.publicKey !== null) { message.publicKey = Any.fromJSON(object.publicKey); } else { @@ -236,6 +238,16 @@ export const SignatureDescriptor = { return message; }, + toJSON(message: SignatureDescriptor): unknown { + const obj: any = {}; + message.publicKey !== undefined && + (obj.publicKey = message.publicKey ? Any.toJSON(message.publicKey) : undefined); + message.data !== undefined && + (obj.data = message.data ? SignatureDescriptor_Data.toJSON(message.data) : undefined); + message.sequence !== undefined && (obj.sequence = (message.sequence || Long.UZERO).toString()); + return obj; + }, + fromPartial(object: DeepPartial): SignatureDescriptor { const message = { ...baseSignatureDescriptor } as SignatureDescriptor; if (object.publicKey !== undefined && object.publicKey !== null) { @@ -255,16 +267,6 @@ export const SignatureDescriptor = { } return message; }, - - toJSON(message: SignatureDescriptor): unknown { - const obj: any = {}; - message.publicKey !== undefined && - (obj.publicKey = message.publicKey ? Any.toJSON(message.publicKey) : undefined); - message.data !== undefined && - (obj.data = message.data ? SignatureDescriptor_Data.toJSON(message.data) : undefined); - message.sequence !== undefined && (obj.sequence = (message.sequence || Long.UZERO).toString()); - return obj; - }, }; const baseSignatureDescriptor_Data: object = {}; @@ -283,7 +285,7 @@ export const SignatureDescriptor_Data = { decode(input: _m0.Reader | Uint8Array, length?: number): SignatureDescriptor_Data { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseSignatureDescriptor_Data) as SignatureDescriptor_Data; + const message = { ...baseSignatureDescriptor_Data } as SignatureDescriptor_Data; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -302,7 +304,7 @@ export const SignatureDescriptor_Data = { }, fromJSON(object: any): SignatureDescriptor_Data { - const message = Object.create(baseSignatureDescriptor_Data) as SignatureDescriptor_Data; + const message = { ...baseSignatureDescriptor_Data } as SignatureDescriptor_Data; if (object.single !== undefined && object.single !== null) { message.single = SignatureDescriptor_Data_Single.fromJSON(object.single); } else { @@ -316,6 +318,15 @@ export const SignatureDescriptor_Data = { return message; }, + toJSON(message: SignatureDescriptor_Data): unknown { + const obj: any = {}; + message.single !== undefined && + (obj.single = message.single ? SignatureDescriptor_Data_Single.toJSON(message.single) : undefined); + message.multi !== undefined && + (obj.multi = message.multi ? SignatureDescriptor_Data_Multi.toJSON(message.multi) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): SignatureDescriptor_Data { const message = { ...baseSignatureDescriptor_Data } as SignatureDescriptor_Data; if (object.single !== undefined && object.single !== null) { @@ -330,30 +341,25 @@ export const SignatureDescriptor_Data = { } return message; }, - - toJSON(message: SignatureDescriptor_Data): unknown { - const obj: any = {}; - message.single !== undefined && - (obj.single = message.single ? SignatureDescriptor_Data_Single.toJSON(message.single) : undefined); - message.multi !== undefined && - (obj.multi = message.multi ? SignatureDescriptor_Data_Multi.toJSON(message.multi) : undefined); - return obj; - }, }; const baseSignatureDescriptor_Data_Single: object = { mode: 0 }; export const SignatureDescriptor_Data_Single = { encode(message: SignatureDescriptor_Data_Single, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).int32(message.mode); - writer.uint32(18).bytes(message.signature); + if (message.mode !== 0) { + writer.uint32(8).int32(message.mode); + } + if (message.signature.length !== 0) { + writer.uint32(18).bytes(message.signature); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): SignatureDescriptor_Data_Single { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseSignatureDescriptor_Data_Single) as SignatureDescriptor_Data_Single; + const message = { ...baseSignatureDescriptor_Data_Single } as SignatureDescriptor_Data_Single; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -372,7 +378,7 @@ export const SignatureDescriptor_Data_Single = { }, fromJSON(object: any): SignatureDescriptor_Data_Single { - const message = Object.create(baseSignatureDescriptor_Data_Single) as SignatureDescriptor_Data_Single; + const message = { ...baseSignatureDescriptor_Data_Single } as SignatureDescriptor_Data_Single; if (object.mode !== undefined && object.mode !== null) { message.mode = signModeFromJSON(object.mode); } else { @@ -384,6 +390,16 @@ export const SignatureDescriptor_Data_Single = { return message; }, + toJSON(message: SignatureDescriptor_Data_Single): unknown { + const obj: any = {}; + message.mode !== undefined && (obj.mode = signModeToJSON(message.mode)); + message.signature !== undefined && + (obj.signature = base64FromBytes( + message.signature !== undefined ? message.signature : new Uint8Array(), + )); + return obj; + }, + fromPartial(object: DeepPartial): SignatureDescriptor_Data_Single { const message = { ...baseSignatureDescriptor_Data_Single } as SignatureDescriptor_Data_Single; if (object.mode !== undefined && object.mode !== null) { @@ -398,16 +414,6 @@ export const SignatureDescriptor_Data_Single = { } return message; }, - - toJSON(message: SignatureDescriptor_Data_Single): unknown { - const obj: any = {}; - message.mode !== undefined && (obj.mode = signModeToJSON(message.mode)); - message.signature !== undefined && - (obj.signature = base64FromBytes( - message.signature !== undefined ? message.signature : new Uint8Array(), - )); - return obj; - }, }; const baseSignatureDescriptor_Data_Multi: object = {}; @@ -426,7 +432,7 @@ export const SignatureDescriptor_Data_Multi = { decode(input: _m0.Reader | Uint8Array, length?: number): SignatureDescriptor_Data_Multi { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseSignatureDescriptor_Data_Multi) as SignatureDescriptor_Data_Multi; + const message = { ...baseSignatureDescriptor_Data_Multi } as SignatureDescriptor_Data_Multi; message.signatures = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -446,7 +452,7 @@ export const SignatureDescriptor_Data_Multi = { }, fromJSON(object: any): SignatureDescriptor_Data_Multi { - const message = Object.create(baseSignatureDescriptor_Data_Multi) as SignatureDescriptor_Data_Multi; + const message = { ...baseSignatureDescriptor_Data_Multi } as SignatureDescriptor_Data_Multi; message.signatures = []; if (object.bitarray !== undefined && object.bitarray !== null) { message.bitarray = CompactBitArray.fromJSON(object.bitarray); @@ -461,6 +467,18 @@ export const SignatureDescriptor_Data_Multi = { return message; }, + toJSON(message: SignatureDescriptor_Data_Multi): unknown { + const obj: any = {}; + message.bitarray !== undefined && + (obj.bitarray = message.bitarray ? CompactBitArray.toJSON(message.bitarray) : undefined); + if (message.signatures) { + obj.signatures = message.signatures.map((e) => (e ? SignatureDescriptor_Data.toJSON(e) : undefined)); + } else { + obj.signatures = []; + } + return obj; + }, + fromPartial(object: DeepPartial): SignatureDescriptor_Data_Multi { const message = { ...baseSignatureDescriptor_Data_Multi } as SignatureDescriptor_Data_Multi; message.signatures = []; @@ -476,18 +494,6 @@ export const SignatureDescriptor_Data_Multi = { } return message; }, - - toJSON(message: SignatureDescriptor_Data_Multi): unknown { - const obj: any = {}; - message.bitarray !== undefined && - (obj.bitarray = message.bitarray ? CompactBitArray.toJSON(message.bitarray) : undefined); - if (message.signatures) { - obj.signatures = message.signatures.map((e) => (e ? SignatureDescriptor_Data.toJSON(e) : undefined)); - } else { - obj.signatures = []; - } - return obj; - }, }; declare var self: any | undefined; @@ -497,7 +503,7 @@ var globalThis: any = (() => { if (typeof self !== "undefined") return self; if (typeof window !== "undefined") return window; if (typeof global !== "undefined") return global; - throw new Error("Unable to locate global object"); + throw "Unable to locate global object"; })(); const atob: (b64: string) => string = diff --git a/packages/stargate/src/codec/cosmos/tx/v1beta1/tx.ts b/packages/stargate/src/codec/cosmos/tx/v1beta1/tx.ts index 2351eb8b..5b23d016 100644 --- a/packages/stargate/src/codec/cosmos/tx/v1beta1/tx.ts +++ b/packages/stargate/src/codec/cosmos/tx/v1beta1/tx.ts @@ -226,7 +226,7 @@ export const Tx = { decode(input: _m0.Reader | Uint8Array, length?: number): Tx { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseTx) as Tx; + const message = { ...baseTx } as Tx; message.signatures = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -249,7 +249,7 @@ export const Tx = { }, fromJSON(object: any): Tx { - const message = Object.create(baseTx) as Tx; + const message = { ...baseTx } as Tx; message.signatures = []; if (object.body !== undefined && object.body !== null) { message.body = TxBody.fromJSON(object.body); @@ -269,6 +269,19 @@ export const Tx = { return message; }, + toJSON(message: Tx): unknown { + const obj: any = {}; + message.body !== undefined && (obj.body = message.body ? TxBody.toJSON(message.body) : undefined); + message.authInfo !== undefined && + (obj.authInfo = message.authInfo ? AuthInfo.toJSON(message.authInfo) : undefined); + if (message.signatures) { + obj.signatures = message.signatures.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.signatures = []; + } + return obj; + }, + fromPartial(object: DeepPartial): Tx { const message = { ...baseTx } as Tx; message.signatures = []; @@ -289,27 +302,18 @@ export const Tx = { } return message; }, - - toJSON(message: Tx): unknown { - const obj: any = {}; - message.body !== undefined && (obj.body = message.body ? TxBody.toJSON(message.body) : undefined); - message.authInfo !== undefined && - (obj.authInfo = message.authInfo ? AuthInfo.toJSON(message.authInfo) : undefined); - if (message.signatures) { - obj.signatures = message.signatures.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.signatures = []; - } - return obj; - }, }; const baseTxRaw: object = {}; export const TxRaw = { encode(message: TxRaw, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).bytes(message.bodyBytes); - writer.uint32(18).bytes(message.authInfoBytes); + if (message.bodyBytes.length !== 0) { + writer.uint32(10).bytes(message.bodyBytes); + } + if (message.authInfoBytes.length !== 0) { + writer.uint32(18).bytes(message.authInfoBytes); + } for (const v of message.signatures) { writer.uint32(26).bytes(v!); } @@ -319,7 +323,7 @@ export const TxRaw = { decode(input: _m0.Reader | Uint8Array, length?: number): TxRaw { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseTxRaw) as TxRaw; + const message = { ...baseTxRaw } as TxRaw; message.signatures = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -342,7 +346,7 @@ export const TxRaw = { }, fromJSON(object: any): TxRaw { - const message = Object.create(baseTxRaw) as TxRaw; + const message = { ...baseTxRaw } as TxRaw; message.signatures = []; if (object.bodyBytes !== undefined && object.bodyBytes !== null) { message.bodyBytes = bytesFromBase64(object.bodyBytes); @@ -358,27 +362,6 @@ export const TxRaw = { return message; }, - fromPartial(object: DeepPartial): TxRaw { - const message = { ...baseTxRaw } as TxRaw; - message.signatures = []; - if (object.bodyBytes !== undefined && object.bodyBytes !== null) { - message.bodyBytes = object.bodyBytes; - } else { - message.bodyBytes = new Uint8Array(); - } - if (object.authInfoBytes !== undefined && object.authInfoBytes !== null) { - message.authInfoBytes = object.authInfoBytes; - } else { - message.authInfoBytes = new Uint8Array(); - } - if (object.signatures !== undefined && object.signatures !== null) { - for (const e of object.signatures) { - message.signatures.push(e); - } - } - return message; - }, - toJSON(message: TxRaw): unknown { const obj: any = {}; message.bodyBytes !== undefined && @@ -396,23 +379,52 @@ export const TxRaw = { } return obj; }, + + fromPartial(object: DeepPartial): TxRaw { + const message = { ...baseTxRaw } as TxRaw; + message.signatures = []; + if (object.bodyBytes !== undefined && object.bodyBytes !== null) { + message.bodyBytes = object.bodyBytes; + } else { + message.bodyBytes = new Uint8Array(); + } + if (object.authInfoBytes !== undefined && object.authInfoBytes !== null) { + message.authInfoBytes = object.authInfoBytes; + } else { + message.authInfoBytes = new Uint8Array(); + } + if (object.signatures !== undefined && object.signatures !== null) { + for (const e of object.signatures) { + message.signatures.push(e); + } + } + return message; + }, }; const baseSignDoc: object = { chainId: "", accountNumber: Long.UZERO }; export const SignDoc = { encode(message: SignDoc, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).bytes(message.bodyBytes); - writer.uint32(18).bytes(message.authInfoBytes); - writer.uint32(26).string(message.chainId); - writer.uint32(32).uint64(message.accountNumber); + if (message.bodyBytes.length !== 0) { + writer.uint32(10).bytes(message.bodyBytes); + } + if (message.authInfoBytes.length !== 0) { + writer.uint32(18).bytes(message.authInfoBytes); + } + if (message.chainId !== "") { + writer.uint32(26).string(message.chainId); + } + if (!message.accountNumber.isZero()) { + writer.uint32(32).uint64(message.accountNumber); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): SignDoc { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseSignDoc) as SignDoc; + const message = { ...baseSignDoc } as SignDoc; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -437,7 +449,7 @@ export const SignDoc = { }, fromJSON(object: any): SignDoc { - const message = Object.create(baseSignDoc) as SignDoc; + const message = { ...baseSignDoc } as SignDoc; if (object.bodyBytes !== undefined && object.bodyBytes !== null) { message.bodyBytes = bytesFromBase64(object.bodyBytes); } @@ -457,6 +469,22 @@ export const SignDoc = { return message; }, + toJSON(message: SignDoc): unknown { + const obj: any = {}; + message.bodyBytes !== undefined && + (obj.bodyBytes = base64FromBytes( + message.bodyBytes !== undefined ? message.bodyBytes : new Uint8Array(), + )); + message.authInfoBytes !== undefined && + (obj.authInfoBytes = base64FromBytes( + message.authInfoBytes !== undefined ? message.authInfoBytes : new Uint8Array(), + )); + message.chainId !== undefined && (obj.chainId = message.chainId); + message.accountNumber !== undefined && + (obj.accountNumber = (message.accountNumber || Long.UZERO).toString()); + return obj; + }, + fromPartial(object: DeepPartial): SignDoc { const message = { ...baseSignDoc } as SignDoc; if (object.bodyBytes !== undefined && object.bodyBytes !== null) { @@ -481,22 +509,6 @@ export const SignDoc = { } return message; }, - - toJSON(message: SignDoc): unknown { - const obj: any = {}; - message.bodyBytes !== undefined && - (obj.bodyBytes = base64FromBytes( - message.bodyBytes !== undefined ? message.bodyBytes : new Uint8Array(), - )); - message.authInfoBytes !== undefined && - (obj.authInfoBytes = base64FromBytes( - message.authInfoBytes !== undefined ? message.authInfoBytes : new Uint8Array(), - )); - message.chainId !== undefined && (obj.chainId = message.chainId); - message.accountNumber !== undefined && - (obj.accountNumber = (message.accountNumber || Long.UZERO).toString()); - return obj; - }, }; const baseTxBody: object = { memo: "", timeoutHeight: Long.UZERO }; @@ -506,8 +518,12 @@ export const TxBody = { for (const v of message.messages) { Any.encode(v!, writer.uint32(10).fork()).ldelim(); } - writer.uint32(18).string(message.memo); - writer.uint32(24).uint64(message.timeoutHeight); + if (message.memo !== "") { + writer.uint32(18).string(message.memo); + } + if (!message.timeoutHeight.isZero()) { + writer.uint32(24).uint64(message.timeoutHeight); + } for (const v of message.extensionOptions) { Any.encode(v!, writer.uint32(8186).fork()).ldelim(); } @@ -520,7 +536,7 @@ export const TxBody = { decode(input: _m0.Reader | Uint8Array, length?: number): TxBody { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseTxBody) as TxBody; + const message = { ...baseTxBody } as TxBody; message.messages = []; message.extensionOptions = []; message.nonCriticalExtensionOptions = []; @@ -551,7 +567,7 @@ export const TxBody = { }, fromJSON(object: any): TxBody { - const message = Object.create(baseTxBody) as TxBody; + const message = { ...baseTxBody } as TxBody; message.messages = []; message.extensionOptions = []; message.nonCriticalExtensionOptions = []; @@ -583,6 +599,31 @@ export const TxBody = { return message; }, + toJSON(message: TxBody): unknown { + const obj: any = {}; + if (message.messages) { + obj.messages = message.messages.map((e) => (e ? Any.toJSON(e) : undefined)); + } else { + obj.messages = []; + } + message.memo !== undefined && (obj.memo = message.memo); + message.timeoutHeight !== undefined && + (obj.timeoutHeight = (message.timeoutHeight || Long.UZERO).toString()); + if (message.extensionOptions) { + obj.extensionOptions = message.extensionOptions.map((e) => (e ? Any.toJSON(e) : undefined)); + } else { + obj.extensionOptions = []; + } + if (message.nonCriticalExtensionOptions) { + obj.nonCriticalExtensionOptions = message.nonCriticalExtensionOptions.map((e) => + e ? Any.toJSON(e) : undefined, + ); + } else { + obj.nonCriticalExtensionOptions = []; + } + return obj; + }, + fromPartial(object: DeepPartial): TxBody { const message = { ...baseTxBody } as TxBody; message.messages = []; @@ -615,31 +656,6 @@ export const TxBody = { } return message; }, - - toJSON(message: TxBody): unknown { - const obj: any = {}; - if (message.messages) { - obj.messages = message.messages.map((e) => (e ? Any.toJSON(e) : undefined)); - } else { - obj.messages = []; - } - message.memo !== undefined && (obj.memo = message.memo); - message.timeoutHeight !== undefined && - (obj.timeoutHeight = (message.timeoutHeight || Long.UZERO).toString()); - if (message.extensionOptions) { - obj.extensionOptions = message.extensionOptions.map((e) => (e ? Any.toJSON(e) : undefined)); - } else { - obj.extensionOptions = []; - } - if (message.nonCriticalExtensionOptions) { - obj.nonCriticalExtensionOptions = message.nonCriticalExtensionOptions.map((e) => - e ? Any.toJSON(e) : undefined, - ); - } else { - obj.nonCriticalExtensionOptions = []; - } - return obj; - }, }; const baseAuthInfo: object = {}; @@ -658,7 +674,7 @@ export const AuthInfo = { decode(input: _m0.Reader | Uint8Array, length?: number): AuthInfo { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseAuthInfo) as AuthInfo; + const message = { ...baseAuthInfo } as AuthInfo; message.signerInfos = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -678,7 +694,7 @@ export const AuthInfo = { }, fromJSON(object: any): AuthInfo { - const message = Object.create(baseAuthInfo) as AuthInfo; + const message = { ...baseAuthInfo } as AuthInfo; message.signerInfos = []; if (object.signerInfos !== undefined && object.signerInfos !== null) { for (const e of object.signerInfos) { @@ -693,6 +709,17 @@ export const AuthInfo = { return message; }, + toJSON(message: AuthInfo): unknown { + const obj: any = {}; + if (message.signerInfos) { + obj.signerInfos = message.signerInfos.map((e) => (e ? SignerInfo.toJSON(e) : undefined)); + } else { + obj.signerInfos = []; + } + message.fee !== undefined && (obj.fee = message.fee ? Fee.toJSON(message.fee) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): AuthInfo { const message = { ...baseAuthInfo } as AuthInfo; message.signerInfos = []; @@ -708,17 +735,6 @@ export const AuthInfo = { } return message; }, - - toJSON(message: AuthInfo): unknown { - const obj: any = {}; - if (message.signerInfos) { - obj.signerInfos = message.signerInfos.map((e) => (e ? SignerInfo.toJSON(e) : undefined)); - } else { - obj.signerInfos = []; - } - message.fee !== undefined && (obj.fee = message.fee ? Fee.toJSON(message.fee) : undefined); - return obj; - }, }; const baseSignerInfo: object = { sequence: Long.UZERO }; @@ -731,14 +747,16 @@ export const SignerInfo = { if (message.modeInfo !== undefined) { ModeInfo.encode(message.modeInfo, writer.uint32(18).fork()).ldelim(); } - writer.uint32(24).uint64(message.sequence); + if (!message.sequence.isZero()) { + writer.uint32(24).uint64(message.sequence); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): SignerInfo { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseSignerInfo) as SignerInfo; + const message = { ...baseSignerInfo } as SignerInfo; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -760,7 +778,7 @@ export const SignerInfo = { }, fromJSON(object: any): SignerInfo { - const message = Object.create(baseSignerInfo) as SignerInfo; + const message = { ...baseSignerInfo } as SignerInfo; if (object.publicKey !== undefined && object.publicKey !== null) { message.publicKey = Any.fromJSON(object.publicKey); } else { @@ -779,6 +797,16 @@ export const SignerInfo = { return message; }, + toJSON(message: SignerInfo): unknown { + const obj: any = {}; + message.publicKey !== undefined && + (obj.publicKey = message.publicKey ? Any.toJSON(message.publicKey) : undefined); + message.modeInfo !== undefined && + (obj.modeInfo = message.modeInfo ? ModeInfo.toJSON(message.modeInfo) : undefined); + message.sequence !== undefined && (obj.sequence = (message.sequence || Long.UZERO).toString()); + return obj; + }, + fromPartial(object: DeepPartial): SignerInfo { const message = { ...baseSignerInfo } as SignerInfo; if (object.publicKey !== undefined && object.publicKey !== null) { @@ -798,16 +826,6 @@ export const SignerInfo = { } return message; }, - - toJSON(message: SignerInfo): unknown { - const obj: any = {}; - message.publicKey !== undefined && - (obj.publicKey = message.publicKey ? Any.toJSON(message.publicKey) : undefined); - message.modeInfo !== undefined && - (obj.modeInfo = message.modeInfo ? ModeInfo.toJSON(message.modeInfo) : undefined); - message.sequence !== undefined && (obj.sequence = (message.sequence || Long.UZERO).toString()); - return obj; - }, }; const baseModeInfo: object = {}; @@ -826,7 +844,7 @@ export const ModeInfo = { decode(input: _m0.Reader | Uint8Array, length?: number): ModeInfo { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseModeInfo) as ModeInfo; + const message = { ...baseModeInfo } as ModeInfo; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -845,7 +863,7 @@ export const ModeInfo = { }, fromJSON(object: any): ModeInfo { - const message = Object.create(baseModeInfo) as ModeInfo; + const message = { ...baseModeInfo } as ModeInfo; if (object.single !== undefined && object.single !== null) { message.single = ModeInfo_Single.fromJSON(object.single); } else { @@ -859,6 +877,15 @@ export const ModeInfo = { return message; }, + toJSON(message: ModeInfo): unknown { + const obj: any = {}; + message.single !== undefined && + (obj.single = message.single ? ModeInfo_Single.toJSON(message.single) : undefined); + message.multi !== undefined && + (obj.multi = message.multi ? ModeInfo_Multi.toJSON(message.multi) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): ModeInfo { const message = { ...baseModeInfo } as ModeInfo; if (object.single !== undefined && object.single !== null) { @@ -873,29 +900,22 @@ export const ModeInfo = { } return message; }, - - toJSON(message: ModeInfo): unknown { - const obj: any = {}; - message.single !== undefined && - (obj.single = message.single ? ModeInfo_Single.toJSON(message.single) : undefined); - message.multi !== undefined && - (obj.multi = message.multi ? ModeInfo_Multi.toJSON(message.multi) : undefined); - return obj; - }, }; const baseModeInfo_Single: object = { mode: 0 }; export const ModeInfo_Single = { encode(message: ModeInfo_Single, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).int32(message.mode); + if (message.mode !== 0) { + writer.uint32(8).int32(message.mode); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): ModeInfo_Single { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseModeInfo_Single) as ModeInfo_Single; + const message = { ...baseModeInfo_Single } as ModeInfo_Single; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -911,19 +931,9 @@ export const ModeInfo_Single = { }, fromJSON(object: any): ModeInfo_Single { - const message = Object.create(baseModeInfo_Single) as ModeInfo_Single; - if (object.mode !== undefined && object.mode !== null) { - message.mode = signModeFromJSON(object.mode); - } else { - message.mode = 0; - } - return message; - }, - - fromPartial(object: DeepPartial): ModeInfo_Single { const message = { ...baseModeInfo_Single } as ModeInfo_Single; if (object.mode !== undefined && object.mode !== null) { - message.mode = object.mode; + message.mode = signModeFromJSON(object.mode); } else { message.mode = 0; } @@ -935,6 +945,16 @@ export const ModeInfo_Single = { message.mode !== undefined && (obj.mode = signModeToJSON(message.mode)); return obj; }, + + fromPartial(object: DeepPartial): ModeInfo_Single { + const message = { ...baseModeInfo_Single } as ModeInfo_Single; + if (object.mode !== undefined && object.mode !== null) { + message.mode = object.mode; + } else { + message.mode = 0; + } + return message; + }, }; const baseModeInfo_Multi: object = {}; @@ -953,7 +973,7 @@ export const ModeInfo_Multi = { decode(input: _m0.Reader | Uint8Array, length?: number): ModeInfo_Multi { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseModeInfo_Multi) as ModeInfo_Multi; + const message = { ...baseModeInfo_Multi } as ModeInfo_Multi; message.modeInfos = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -973,7 +993,7 @@ export const ModeInfo_Multi = { }, fromJSON(object: any): ModeInfo_Multi { - const message = Object.create(baseModeInfo_Multi) as ModeInfo_Multi; + const message = { ...baseModeInfo_Multi } as ModeInfo_Multi; message.modeInfos = []; if (object.bitarray !== undefined && object.bitarray !== null) { message.bitarray = CompactBitArray.fromJSON(object.bitarray); @@ -988,6 +1008,18 @@ export const ModeInfo_Multi = { return message; }, + toJSON(message: ModeInfo_Multi): unknown { + const obj: any = {}; + message.bitarray !== undefined && + (obj.bitarray = message.bitarray ? CompactBitArray.toJSON(message.bitarray) : undefined); + if (message.modeInfos) { + obj.modeInfos = message.modeInfos.map((e) => (e ? ModeInfo.toJSON(e) : undefined)); + } else { + obj.modeInfos = []; + } + return obj; + }, + fromPartial(object: DeepPartial): ModeInfo_Multi { const message = { ...baseModeInfo_Multi } as ModeInfo_Multi; message.modeInfos = []; @@ -1003,18 +1035,6 @@ export const ModeInfo_Multi = { } return message; }, - - toJSON(message: ModeInfo_Multi): unknown { - const obj: any = {}; - message.bitarray !== undefined && - (obj.bitarray = message.bitarray ? CompactBitArray.toJSON(message.bitarray) : undefined); - if (message.modeInfos) { - obj.modeInfos = message.modeInfos.map((e) => (e ? ModeInfo.toJSON(e) : undefined)); - } else { - obj.modeInfos = []; - } - return obj; - }, }; const baseFee: object = { gasLimit: Long.UZERO, payer: "", granter: "" }; @@ -1024,16 +1044,22 @@ export const Fee = { for (const v of message.amount) { Coin.encode(v!, writer.uint32(10).fork()).ldelim(); } - writer.uint32(16).uint64(message.gasLimit); - writer.uint32(26).string(message.payer); - writer.uint32(34).string(message.granter); + if (!message.gasLimit.isZero()) { + writer.uint32(16).uint64(message.gasLimit); + } + if (message.payer !== "") { + writer.uint32(26).string(message.payer); + } + if (message.granter !== "") { + writer.uint32(34).string(message.granter); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): Fee { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseFee) as Fee; + const message = { ...baseFee } as Fee; message.amount = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -1059,7 +1085,7 @@ export const Fee = { }, fromJSON(object: any): Fee { - const message = Object.create(baseFee) as Fee; + const message = { ...baseFee } as Fee; message.amount = []; if (object.amount !== undefined && object.amount !== null) { for (const e of object.amount) { @@ -1084,6 +1110,19 @@ export const Fee = { return message; }, + toJSON(message: Fee): unknown { + const obj: any = {}; + if (message.amount) { + obj.amount = message.amount.map((e) => (e ? Coin.toJSON(e) : undefined)); + } else { + obj.amount = []; + } + message.gasLimit !== undefined && (obj.gasLimit = (message.gasLimit || Long.UZERO).toString()); + message.payer !== undefined && (obj.payer = message.payer); + message.granter !== undefined && (obj.granter = message.granter); + return obj; + }, + fromPartial(object: DeepPartial): Fee { const message = { ...baseFee } as Fee; message.amount = []; @@ -1109,19 +1148,6 @@ export const Fee = { } return message; }, - - toJSON(message: Fee): unknown { - const obj: any = {}; - if (message.amount) { - obj.amount = message.amount.map((e) => (e ? Coin.toJSON(e) : undefined)); - } else { - obj.amount = []; - } - message.gasLimit !== undefined && (obj.gasLimit = (message.gasLimit || Long.UZERO).toString()); - message.payer !== undefined && (obj.payer = message.payer); - message.granter !== undefined && (obj.granter = message.granter); - return obj; - }, }; declare var self: any | undefined; @@ -1131,7 +1157,7 @@ var globalThis: any = (() => { if (typeof self !== "undefined") return self; if (typeof window !== "undefined") return window; if (typeof global !== "undefined") return global; - throw new Error("Unable to locate global object"); + throw "Unable to locate global object"; })(); const atob: (b64: string) => string = diff --git a/packages/stargate/src/codec/google/protobuf/any.ts b/packages/stargate/src/codec/google/protobuf/any.ts index b7b803f5..80a855cc 100644 --- a/packages/stargate/src/codec/google/protobuf/any.ts +++ b/packages/stargate/src/codec/google/protobuf/any.ts @@ -124,15 +124,19 @@ const baseAny: object = { typeUrl: "" }; export const Any = { encode(message: Any, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.typeUrl); - writer.uint32(18).bytes(message.value); + if (message.typeUrl !== "") { + writer.uint32(10).string(message.typeUrl); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): Any { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseAny) as Any; + const message = { ...baseAny } as Any; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -151,7 +155,7 @@ export const Any = { }, fromJSON(object: any): Any { - const message = Object.create(baseAny) as Any; + const message = { ...baseAny } as Any; if (object.typeUrl !== undefined && object.typeUrl !== null) { message.typeUrl = String(object.typeUrl); } else { @@ -163,6 +167,14 @@ export const Any = { return message; }, + toJSON(message: Any): unknown { + const obj: any = {}; + message.typeUrl !== undefined && (obj.typeUrl = message.typeUrl); + message.value !== undefined && + (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); + return obj; + }, + fromPartial(object: DeepPartial): Any { const message = { ...baseAny } as Any; if (object.typeUrl !== undefined && object.typeUrl !== null) { @@ -177,14 +189,6 @@ export const Any = { } return message; }, - - toJSON(message: Any): unknown { - const obj: any = {}; - message.typeUrl !== undefined && (obj.typeUrl = message.typeUrl); - message.value !== undefined && - (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); - return obj; - }, }; declare var self: any | undefined; @@ -194,7 +198,7 @@ var globalThis: any = (() => { if (typeof self !== "undefined") return self; if (typeof window !== "undefined") return window; if (typeof global !== "undefined") return global; - throw new Error("Unable to locate global object"); + throw "Unable to locate global object"; })(); const atob: (b64: string) => string = diff --git a/packages/stargate/src/codec/google/protobuf/duration.ts b/packages/stargate/src/codec/google/protobuf/duration.ts index 6858ff61..b56dde8f 100644 --- a/packages/stargate/src/codec/google/protobuf/duration.ts +++ b/packages/stargate/src/codec/google/protobuf/duration.ts @@ -86,15 +86,19 @@ const baseDuration: object = { seconds: Long.ZERO, nanos: 0 }; export const Duration = { encode(message: Duration, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).int64(message.seconds); - writer.uint32(16).int32(message.nanos); + if (!message.seconds.isZero()) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): Duration { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseDuration) as Duration; + const message = { ...baseDuration } as Duration; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -113,7 +117,7 @@ export const Duration = { }, fromJSON(object: any): Duration { - const message = Object.create(baseDuration) as Duration; + const message = { ...baseDuration } as Duration; if (object.seconds !== undefined && object.seconds !== null) { message.seconds = Long.fromString(object.seconds); } else { @@ -127,6 +131,13 @@ export const Duration = { return message; }, + toJSON(message: Duration): unknown { + const obj: any = {}; + message.seconds !== undefined && (obj.seconds = (message.seconds || Long.ZERO).toString()); + message.nanos !== undefined && (obj.nanos = message.nanos); + return obj; + }, + fromPartial(object: DeepPartial): Duration { const message = { ...baseDuration } as Duration; if (object.seconds !== undefined && object.seconds !== null) { @@ -141,13 +152,6 @@ export const Duration = { } return message; }, - - toJSON(message: Duration): unknown { - const obj: any = {}; - message.seconds !== undefined && (obj.seconds = (message.seconds || Long.ZERO).toString()); - message.nanos !== undefined && (obj.nanos = message.nanos); - return obj; - }, }; type Builtin = Date | Function | Uint8Array | string | number | undefined | Long; diff --git a/packages/stargate/src/codec/google/protobuf/timestamp.ts b/packages/stargate/src/codec/google/protobuf/timestamp.ts index 89f7c112..a6b054fe 100644 --- a/packages/stargate/src/codec/google/protobuf/timestamp.ts +++ b/packages/stargate/src/codec/google/protobuf/timestamp.ts @@ -117,15 +117,19 @@ const baseTimestamp: object = { seconds: Long.ZERO, nanos: 0 }; export const Timestamp = { encode(message: Timestamp, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).int64(message.seconds); - writer.uint32(16).int32(message.nanos); + if (!message.seconds.isZero()) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): Timestamp { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseTimestamp) as Timestamp; + const message = { ...baseTimestamp } as Timestamp; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -144,7 +148,7 @@ export const Timestamp = { }, fromJSON(object: any): Timestamp { - const message = Object.create(baseTimestamp) as Timestamp; + const message = { ...baseTimestamp } as Timestamp; if (object.seconds !== undefined && object.seconds !== null) { message.seconds = Long.fromString(object.seconds); } else { @@ -158,6 +162,13 @@ export const Timestamp = { return message; }, + toJSON(message: Timestamp): unknown { + const obj: any = {}; + message.seconds !== undefined && (obj.seconds = (message.seconds || Long.ZERO).toString()); + message.nanos !== undefined && (obj.nanos = message.nanos); + return obj; + }, + fromPartial(object: DeepPartial): Timestamp { const message = { ...baseTimestamp } as Timestamp; if (object.seconds !== undefined && object.seconds !== null) { @@ -172,13 +183,6 @@ export const Timestamp = { } return message; }, - - toJSON(message: Timestamp): unknown { - const obj: any = {}; - message.seconds !== undefined && (obj.seconds = (message.seconds || Long.ZERO).toString()); - message.nanos !== undefined && (obj.nanos = message.nanos); - return obj; - }, }; type Builtin = Date | Function | Uint8Array | string | number | undefined | Long; diff --git a/packages/stargate/src/codec/ibc/core/channel/v1/channel.ts b/packages/stargate/src/codec/ibc/core/channel/v1/channel.ts index 07cd9f35..9d1f25a0 100644 --- a/packages/stargate/src/codec/ibc/core/channel/v1/channel.ts +++ b/packages/stargate/src/codec/ibc/core/channel/v1/channel.ts @@ -227,22 +227,28 @@ const baseChannel: object = { state: 0, ordering: 0, connectionHops: "", version export const Channel = { encode(message: Channel, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).int32(message.state); - writer.uint32(16).int32(message.ordering); + if (message.state !== 0) { + writer.uint32(8).int32(message.state); + } + if (message.ordering !== 0) { + writer.uint32(16).int32(message.ordering); + } if (message.counterparty !== undefined) { Counterparty.encode(message.counterparty, writer.uint32(26).fork()).ldelim(); } for (const v of message.connectionHops) { writer.uint32(34).string(v!); } - writer.uint32(42).string(message.version); + if (message.version !== "") { + writer.uint32(42).string(message.version); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): Channel { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseChannel) as Channel; + const message = { ...baseChannel } as Channel; message.connectionHops = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -271,7 +277,7 @@ export const Channel = { }, fromJSON(object: any): Channel { - const message = Object.create(baseChannel) as Channel; + const message = { ...baseChannel } as Channel; message.connectionHops = []; if (object.state !== undefined && object.state !== null) { message.state = stateFromJSON(object.state); @@ -301,6 +307,21 @@ export const Channel = { return message; }, + toJSON(message: Channel): unknown { + const obj: any = {}; + message.state !== undefined && (obj.state = stateToJSON(message.state)); + message.ordering !== undefined && (obj.ordering = orderToJSON(message.ordering)); + message.counterparty !== undefined && + (obj.counterparty = message.counterparty ? Counterparty.toJSON(message.counterparty) : undefined); + if (message.connectionHops) { + obj.connectionHops = message.connectionHops.map((e) => e); + } else { + obj.connectionHops = []; + } + message.version !== undefined && (obj.version = message.version); + return obj; + }, + fromPartial(object: DeepPartial): Channel { const message = { ...baseChannel } as Channel; message.connectionHops = []; @@ -331,21 +352,6 @@ export const Channel = { } return message; }, - - toJSON(message: Channel): unknown { - const obj: any = {}; - message.state !== undefined && (obj.state = stateToJSON(message.state)); - message.ordering !== undefined && (obj.ordering = orderToJSON(message.ordering)); - message.counterparty !== undefined && - (obj.counterparty = message.counterparty ? Counterparty.toJSON(message.counterparty) : undefined); - if (message.connectionHops) { - obj.connectionHops = message.connectionHops.map((e) => e); - } else { - obj.connectionHops = []; - } - message.version !== undefined && (obj.version = message.version); - return obj; - }, }; const baseIdentifiedChannel: object = { @@ -359,24 +365,34 @@ const baseIdentifiedChannel: object = { export const IdentifiedChannel = { encode(message: IdentifiedChannel, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).int32(message.state); - writer.uint32(16).int32(message.ordering); + if (message.state !== 0) { + writer.uint32(8).int32(message.state); + } + if (message.ordering !== 0) { + writer.uint32(16).int32(message.ordering); + } if (message.counterparty !== undefined) { Counterparty.encode(message.counterparty, writer.uint32(26).fork()).ldelim(); } for (const v of message.connectionHops) { writer.uint32(34).string(v!); } - writer.uint32(42).string(message.version); - writer.uint32(50).string(message.portId); - writer.uint32(58).string(message.channelId); + if (message.version !== "") { + writer.uint32(42).string(message.version); + } + if (message.portId !== "") { + writer.uint32(50).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(58).string(message.channelId); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): IdentifiedChannel { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseIdentifiedChannel) as IdentifiedChannel; + const message = { ...baseIdentifiedChannel } as IdentifiedChannel; message.connectionHops = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -411,7 +427,7 @@ export const IdentifiedChannel = { }, fromJSON(object: any): IdentifiedChannel { - const message = Object.create(baseIdentifiedChannel) as IdentifiedChannel; + const message = { ...baseIdentifiedChannel } as IdentifiedChannel; message.connectionHops = []; if (object.state !== undefined && object.state !== null) { message.state = stateFromJSON(object.state); @@ -451,6 +467,23 @@ export const IdentifiedChannel = { return message; }, + toJSON(message: IdentifiedChannel): unknown { + const obj: any = {}; + message.state !== undefined && (obj.state = stateToJSON(message.state)); + message.ordering !== undefined && (obj.ordering = orderToJSON(message.ordering)); + message.counterparty !== undefined && + (obj.counterparty = message.counterparty ? Counterparty.toJSON(message.counterparty) : undefined); + if (message.connectionHops) { + obj.connectionHops = message.connectionHops.map((e) => e); + } else { + obj.connectionHops = []; + } + message.version !== undefined && (obj.version = message.version); + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + return obj; + }, + fromPartial(object: DeepPartial): IdentifiedChannel { const message = { ...baseIdentifiedChannel } as IdentifiedChannel; message.connectionHops = []; @@ -491,38 +524,25 @@ export const IdentifiedChannel = { } return message; }, - - toJSON(message: IdentifiedChannel): unknown { - const obj: any = {}; - message.state !== undefined && (obj.state = stateToJSON(message.state)); - message.ordering !== undefined && (obj.ordering = orderToJSON(message.ordering)); - message.counterparty !== undefined && - (obj.counterparty = message.counterparty ? Counterparty.toJSON(message.counterparty) : undefined); - if (message.connectionHops) { - obj.connectionHops = message.connectionHops.map((e) => e); - } else { - obj.connectionHops = []; - } - message.version !== undefined && (obj.version = message.version); - message.portId !== undefined && (obj.portId = message.portId); - message.channelId !== undefined && (obj.channelId = message.channelId); - return obj; - }, }; const baseCounterparty: object = { portId: "", channelId: "" }; export const Counterparty = { encode(message: Counterparty, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.portId); - writer.uint32(18).string(message.channelId); + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): Counterparty { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseCounterparty) as Counterparty; + const message = { ...baseCounterparty } as Counterparty; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -541,7 +561,7 @@ export const Counterparty = { }, fromJSON(object: any): Counterparty { - const message = Object.create(baseCounterparty) as Counterparty; + const message = { ...baseCounterparty } as Counterparty; if (object.portId !== undefined && object.portId !== null) { message.portId = String(object.portId); } else { @@ -555,6 +575,13 @@ export const Counterparty = { return message; }, + toJSON(message: Counterparty): unknown { + const obj: any = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + return obj; + }, + fromPartial(object: DeepPartial): Counterparty { const message = { ...baseCounterparty } as Counterparty; if (object.portId !== undefined && object.portId !== null) { @@ -569,13 +596,6 @@ export const Counterparty = { } return message; }, - - toJSON(message: Counterparty): unknown { - const obj: any = {}; - message.portId !== undefined && (obj.portId = message.portId); - message.channelId !== undefined && (obj.channelId = message.channelId); - return obj; - }, }; const basePacket: object = { @@ -589,23 +609,37 @@ const basePacket: object = { export const Packet = { encode(message: Packet, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).uint64(message.sequence); - writer.uint32(18).string(message.sourcePort); - writer.uint32(26).string(message.sourceChannel); - writer.uint32(34).string(message.destinationPort); - writer.uint32(42).string(message.destinationChannel); - writer.uint32(50).bytes(message.data); + if (!message.sequence.isZero()) { + writer.uint32(8).uint64(message.sequence); + } + if (message.sourcePort !== "") { + writer.uint32(18).string(message.sourcePort); + } + if (message.sourceChannel !== "") { + writer.uint32(26).string(message.sourceChannel); + } + if (message.destinationPort !== "") { + writer.uint32(34).string(message.destinationPort); + } + if (message.destinationChannel !== "") { + writer.uint32(42).string(message.destinationChannel); + } + if (message.data.length !== 0) { + writer.uint32(50).bytes(message.data); + } if (message.timeoutHeight !== undefined) { Height.encode(message.timeoutHeight, writer.uint32(58).fork()).ldelim(); } - writer.uint32(64).uint64(message.timeoutTimestamp); + if (!message.timeoutTimestamp.isZero()) { + writer.uint32(64).uint64(message.timeoutTimestamp); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): Packet { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(basePacket) as Packet; + const message = { ...basePacket } as Packet; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -642,7 +676,7 @@ export const Packet = { }, fromJSON(object: any): Packet { - const message = Object.create(basePacket) as Packet; + const message = { ...basePacket } as Packet; if (object.sequence !== undefined && object.sequence !== null) { message.sequence = Long.fromString(object.sequence); } else { @@ -684,6 +718,22 @@ export const Packet = { return message; }, + toJSON(message: Packet): unknown { + const obj: any = {}; + message.sequence !== undefined && (obj.sequence = (message.sequence || Long.UZERO).toString()); + message.sourcePort !== undefined && (obj.sourcePort = message.sourcePort); + message.sourceChannel !== undefined && (obj.sourceChannel = message.sourceChannel); + message.destinationPort !== undefined && (obj.destinationPort = message.destinationPort); + message.destinationChannel !== undefined && (obj.destinationChannel = message.destinationChannel); + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); + message.timeoutHeight !== undefined && + (obj.timeoutHeight = message.timeoutHeight ? Height.toJSON(message.timeoutHeight) : undefined); + message.timeoutTimestamp !== undefined && + (obj.timeoutTimestamp = (message.timeoutTimestamp || Long.UZERO).toString()); + return obj; + }, + fromPartial(object: DeepPartial): Packet { const message = { ...basePacket } as Packet; if (object.sequence !== undefined && object.sequence !== null) { @@ -728,39 +778,31 @@ export const Packet = { } return message; }, - - toJSON(message: Packet): unknown { - const obj: any = {}; - message.sequence !== undefined && (obj.sequence = (message.sequence || Long.UZERO).toString()); - message.sourcePort !== undefined && (obj.sourcePort = message.sourcePort); - message.sourceChannel !== undefined && (obj.sourceChannel = message.sourceChannel); - message.destinationPort !== undefined && (obj.destinationPort = message.destinationPort); - message.destinationChannel !== undefined && (obj.destinationChannel = message.destinationChannel); - message.data !== undefined && - (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); - message.timeoutHeight !== undefined && - (obj.timeoutHeight = message.timeoutHeight ? Height.toJSON(message.timeoutHeight) : undefined); - message.timeoutTimestamp !== undefined && - (obj.timeoutTimestamp = (message.timeoutTimestamp || Long.UZERO).toString()); - return obj; - }, }; const basePacketState: object = { portId: "", channelId: "", sequence: Long.UZERO }; export const PacketState = { encode(message: PacketState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.portId); - writer.uint32(18).string(message.channelId); - writer.uint32(24).uint64(message.sequence); - writer.uint32(34).bytes(message.data); + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + if (!message.sequence.isZero()) { + writer.uint32(24).uint64(message.sequence); + } + if (message.data.length !== 0) { + writer.uint32(34).bytes(message.data); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): PacketState { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(basePacketState) as PacketState; + const message = { ...basePacketState } as PacketState; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -785,7 +827,7 @@ export const PacketState = { }, fromJSON(object: any): PacketState { - const message = Object.create(basePacketState) as PacketState; + const message = { ...basePacketState } as PacketState; if (object.portId !== undefined && object.portId !== null) { message.portId = String(object.portId); } else { @@ -807,6 +849,16 @@ export const PacketState = { return message; }, + toJSON(message: PacketState): unknown { + const obj: any = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + message.sequence !== undefined && (obj.sequence = (message.sequence || Long.UZERO).toString()); + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); + return obj; + }, + fromPartial(object: DeepPartial): PacketState { const message = { ...basePacketState } as PacketState; if (object.portId !== undefined && object.portId !== null) { @@ -831,16 +883,6 @@ export const PacketState = { } return message; }, - - toJSON(message: PacketState): unknown { - const obj: any = {}; - message.portId !== undefined && (obj.portId = message.portId); - message.channelId !== undefined && (obj.channelId = message.channelId); - message.sequence !== undefined && (obj.sequence = (message.sequence || Long.UZERO).toString()); - message.data !== undefined && - (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); - return obj; - }, }; const baseAcknowledgement: object = {}; @@ -859,7 +901,7 @@ export const Acknowledgement = { decode(input: _m0.Reader | Uint8Array, length?: number): Acknowledgement { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseAcknowledgement) as Acknowledgement; + const message = { ...baseAcknowledgement } as Acknowledgement; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -878,7 +920,7 @@ export const Acknowledgement = { }, fromJSON(object: any): Acknowledgement { - const message = Object.create(baseAcknowledgement) as Acknowledgement; + const message = { ...baseAcknowledgement } as Acknowledgement; if (object.result !== undefined && object.result !== null) { message.result = bytesFromBase64(object.result); } @@ -890,6 +932,14 @@ export const Acknowledgement = { return message; }, + toJSON(message: Acknowledgement): unknown { + const obj: any = {}; + message.result !== undefined && + (obj.result = message.result !== undefined ? base64FromBytes(message.result) : undefined); + message.error !== undefined && (obj.error = message.error); + return obj; + }, + fromPartial(object: DeepPartial): Acknowledgement { const message = { ...baseAcknowledgement } as Acknowledgement; if (object.result !== undefined && object.result !== null) { @@ -904,14 +954,6 @@ export const Acknowledgement = { } return message; }, - - toJSON(message: Acknowledgement): unknown { - const obj: any = {}; - message.result !== undefined && - (obj.result = message.result !== undefined ? base64FromBytes(message.result) : undefined); - message.error !== undefined && (obj.error = message.error); - return obj; - }, }; declare var self: any | undefined; @@ -921,7 +963,7 @@ var globalThis: any = (() => { if (typeof self !== "undefined") return self; if (typeof window !== "undefined") return window; if (typeof global !== "undefined") return global; - throw new Error("Unable to locate global object"); + throw "Unable to locate global object"; })(); const atob: (b64: string) => string = diff --git a/packages/stargate/src/codec/ibc/core/channel/v1/query.ts b/packages/stargate/src/codec/ibc/core/channel/v1/query.ts index ea1c90e0..512cb5cc 100644 --- a/packages/stargate/src/codec/ibc/core/channel/v1/query.ts +++ b/packages/stargate/src/codec/ibc/core/channel/v1/query.ts @@ -331,15 +331,19 @@ const baseQueryChannelRequest: object = { portId: "", channelId: "" }; export const QueryChannelRequest = { encode(message: QueryChannelRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.portId); - writer.uint32(18).string(message.channelId); + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryChannelRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryChannelRequest) as QueryChannelRequest; + const message = { ...baseQueryChannelRequest } as QueryChannelRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -358,7 +362,7 @@ export const QueryChannelRequest = { }, fromJSON(object: any): QueryChannelRequest { - const message = Object.create(baseQueryChannelRequest) as QueryChannelRequest; + const message = { ...baseQueryChannelRequest } as QueryChannelRequest; if (object.portId !== undefined && object.portId !== null) { message.portId = String(object.portId); } else { @@ -372,6 +376,13 @@ export const QueryChannelRequest = { return message; }, + toJSON(message: QueryChannelRequest): unknown { + const obj: any = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + return obj; + }, + fromPartial(object: DeepPartial): QueryChannelRequest { const message = { ...baseQueryChannelRequest } as QueryChannelRequest; if (object.portId !== undefined && object.portId !== null) { @@ -386,13 +397,6 @@ export const QueryChannelRequest = { } return message; }, - - toJSON(message: QueryChannelRequest): unknown { - const obj: any = {}; - message.portId !== undefined && (obj.portId = message.portId); - message.channelId !== undefined && (obj.channelId = message.channelId); - return obj; - }, }; const baseQueryChannelResponse: object = {}; @@ -402,7 +406,9 @@ export const QueryChannelResponse = { if (message.channel !== undefined) { Channel.encode(message.channel, writer.uint32(10).fork()).ldelim(); } - writer.uint32(18).bytes(message.proof); + if (message.proof.length !== 0) { + writer.uint32(18).bytes(message.proof); + } if (message.proofHeight !== undefined) { Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); } @@ -412,7 +418,7 @@ export const QueryChannelResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryChannelResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryChannelResponse) as QueryChannelResponse; + const message = { ...baseQueryChannelResponse } as QueryChannelResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -434,7 +440,7 @@ export const QueryChannelResponse = { }, fromJSON(object: any): QueryChannelResponse { - const message = Object.create(baseQueryChannelResponse) as QueryChannelResponse; + const message = { ...baseQueryChannelResponse } as QueryChannelResponse; if (object.channel !== undefined && object.channel !== null) { message.channel = Channel.fromJSON(object.channel); } else { @@ -451,6 +457,17 @@ export const QueryChannelResponse = { return message; }, + toJSON(message: QueryChannelResponse): unknown { + const obj: any = {}; + message.channel !== undefined && + (obj.channel = message.channel ? Channel.toJSON(message.channel) : undefined); + message.proof !== undefined && + (obj.proof = base64FromBytes(message.proof !== undefined ? message.proof : new Uint8Array())); + message.proofHeight !== undefined && + (obj.proofHeight = message.proofHeight ? Height.toJSON(message.proofHeight) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): QueryChannelResponse { const message = { ...baseQueryChannelResponse } as QueryChannelResponse; if (object.channel !== undefined && object.channel !== null) { @@ -470,17 +487,6 @@ export const QueryChannelResponse = { } return message; }, - - toJSON(message: QueryChannelResponse): unknown { - const obj: any = {}; - message.channel !== undefined && - (obj.channel = message.channel ? Channel.toJSON(message.channel) : undefined); - message.proof !== undefined && - (obj.proof = base64FromBytes(message.proof !== undefined ? message.proof : new Uint8Array())); - message.proofHeight !== undefined && - (obj.proofHeight = message.proofHeight ? Height.toJSON(message.proofHeight) : undefined); - return obj; - }, }; const baseQueryChannelsRequest: object = {}; @@ -496,7 +502,7 @@ export const QueryChannelsRequest = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryChannelsRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryChannelsRequest) as QueryChannelsRequest; + const message = { ...baseQueryChannelsRequest } as QueryChannelsRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -512,19 +518,9 @@ export const QueryChannelsRequest = { }, fromJSON(object: any): QueryChannelsRequest { - const message = Object.create(baseQueryChannelsRequest) as QueryChannelsRequest; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageRequest.fromJSON(object.pagination); - } else { - message.pagination = undefined; - } - return message; - }, - - fromPartial(object: DeepPartial): QueryChannelsRequest { const message = { ...baseQueryChannelsRequest } as QueryChannelsRequest; if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageRequest.fromPartial(object.pagination); + message.pagination = PageRequest.fromJSON(object.pagination); } else { message.pagination = undefined; } @@ -537,6 +533,16 @@ export const QueryChannelsRequest = { (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); return obj; }, + + fromPartial(object: DeepPartial): QueryChannelsRequest { + const message = { ...baseQueryChannelsRequest } as QueryChannelsRequest; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromPartial(object.pagination); + } else { + message.pagination = undefined; + } + return message; + }, }; const baseQueryChannelsResponse: object = {}; @@ -558,7 +564,7 @@ export const QueryChannelsResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryChannelsResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryChannelsResponse) as QueryChannelsResponse; + const message = { ...baseQueryChannelsResponse } as QueryChannelsResponse; message.channels = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -581,7 +587,7 @@ export const QueryChannelsResponse = { }, fromJSON(object: any): QueryChannelsResponse { - const message = Object.create(baseQueryChannelsResponse) as QueryChannelsResponse; + const message = { ...baseQueryChannelsResponse } as QueryChannelsResponse; message.channels = []; if (object.channels !== undefined && object.channels !== null) { for (const e of object.channels) { @@ -601,6 +607,19 @@ export const QueryChannelsResponse = { return message; }, + toJSON(message: QueryChannelsResponse): unknown { + const obj: any = {}; + if (message.channels) { + obj.channels = message.channels.map((e) => (e ? IdentifiedChannel.toJSON(e) : undefined)); + } else { + obj.channels = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + message.height !== undefined && (obj.height = message.height ? Height.toJSON(message.height) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): QueryChannelsResponse { const message = { ...baseQueryChannelsResponse } as QueryChannelsResponse; message.channels = []; @@ -621,26 +640,15 @@ export const QueryChannelsResponse = { } return message; }, - - toJSON(message: QueryChannelsResponse): unknown { - const obj: any = {}; - if (message.channels) { - obj.channels = message.channels.map((e) => (e ? IdentifiedChannel.toJSON(e) : undefined)); - } else { - obj.channels = []; - } - message.pagination !== undefined && - (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); - message.height !== undefined && (obj.height = message.height ? Height.toJSON(message.height) : undefined); - return obj; - }, }; const baseQueryConnectionChannelsRequest: object = { connection: "" }; export const QueryConnectionChannelsRequest = { encode(message: QueryConnectionChannelsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.connection); + if (message.connection !== "") { + writer.uint32(10).string(message.connection); + } if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } @@ -650,7 +658,7 @@ export const QueryConnectionChannelsRequest = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryConnectionChannelsRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryConnectionChannelsRequest) as QueryConnectionChannelsRequest; + const message = { ...baseQueryConnectionChannelsRequest } as QueryConnectionChannelsRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -669,7 +677,7 @@ export const QueryConnectionChannelsRequest = { }, fromJSON(object: any): QueryConnectionChannelsRequest { - const message = Object.create(baseQueryConnectionChannelsRequest) as QueryConnectionChannelsRequest; + const message = { ...baseQueryConnectionChannelsRequest } as QueryConnectionChannelsRequest; if (object.connection !== undefined && object.connection !== null) { message.connection = String(object.connection); } else { @@ -683,6 +691,14 @@ export const QueryConnectionChannelsRequest = { return message; }, + toJSON(message: QueryConnectionChannelsRequest): unknown { + const obj: any = {}; + message.connection !== undefined && (obj.connection = message.connection); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): QueryConnectionChannelsRequest { const message = { ...baseQueryConnectionChannelsRequest } as QueryConnectionChannelsRequest; if (object.connection !== undefined && object.connection !== null) { @@ -697,14 +713,6 @@ export const QueryConnectionChannelsRequest = { } return message; }, - - toJSON(message: QueryConnectionChannelsRequest): unknown { - const obj: any = {}; - message.connection !== undefined && (obj.connection = message.connection); - message.pagination !== undefined && - (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); - return obj; - }, }; const baseQueryConnectionChannelsResponse: object = {}; @@ -726,7 +734,7 @@ export const QueryConnectionChannelsResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryConnectionChannelsResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryConnectionChannelsResponse) as QueryConnectionChannelsResponse; + const message = { ...baseQueryConnectionChannelsResponse } as QueryConnectionChannelsResponse; message.channels = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -749,7 +757,7 @@ export const QueryConnectionChannelsResponse = { }, fromJSON(object: any): QueryConnectionChannelsResponse { - const message = Object.create(baseQueryConnectionChannelsResponse) as QueryConnectionChannelsResponse; + const message = { ...baseQueryConnectionChannelsResponse } as QueryConnectionChannelsResponse; message.channels = []; if (object.channels !== undefined && object.channels !== null) { for (const e of object.channels) { @@ -769,6 +777,19 @@ export const QueryConnectionChannelsResponse = { return message; }, + toJSON(message: QueryConnectionChannelsResponse): unknown { + const obj: any = {}; + if (message.channels) { + obj.channels = message.channels.map((e) => (e ? IdentifiedChannel.toJSON(e) : undefined)); + } else { + obj.channels = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + message.height !== undefined && (obj.height = message.height ? Height.toJSON(message.height) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): QueryConnectionChannelsResponse { const message = { ...baseQueryConnectionChannelsResponse } as QueryConnectionChannelsResponse; message.channels = []; @@ -789,34 +810,25 @@ export const QueryConnectionChannelsResponse = { } return message; }, - - toJSON(message: QueryConnectionChannelsResponse): unknown { - const obj: any = {}; - if (message.channels) { - obj.channels = message.channels.map((e) => (e ? IdentifiedChannel.toJSON(e) : undefined)); - } else { - obj.channels = []; - } - message.pagination !== undefined && - (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); - message.height !== undefined && (obj.height = message.height ? Height.toJSON(message.height) : undefined); - return obj; - }, }; const baseQueryChannelClientStateRequest: object = { portId: "", channelId: "" }; export const QueryChannelClientStateRequest = { encode(message: QueryChannelClientStateRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.portId); - writer.uint32(18).string(message.channelId); + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryChannelClientStateRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryChannelClientStateRequest) as QueryChannelClientStateRequest; + const message = { ...baseQueryChannelClientStateRequest } as QueryChannelClientStateRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -835,7 +847,7 @@ export const QueryChannelClientStateRequest = { }, fromJSON(object: any): QueryChannelClientStateRequest { - const message = Object.create(baseQueryChannelClientStateRequest) as QueryChannelClientStateRequest; + const message = { ...baseQueryChannelClientStateRequest } as QueryChannelClientStateRequest; if (object.portId !== undefined && object.portId !== null) { message.portId = String(object.portId); } else { @@ -849,6 +861,13 @@ export const QueryChannelClientStateRequest = { return message; }, + toJSON(message: QueryChannelClientStateRequest): unknown { + const obj: any = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + return obj; + }, + fromPartial(object: DeepPartial): QueryChannelClientStateRequest { const message = { ...baseQueryChannelClientStateRequest } as QueryChannelClientStateRequest; if (object.portId !== undefined && object.portId !== null) { @@ -863,13 +882,6 @@ export const QueryChannelClientStateRequest = { } return message; }, - - toJSON(message: QueryChannelClientStateRequest): unknown { - const obj: any = {}; - message.portId !== undefined && (obj.portId = message.portId); - message.channelId !== undefined && (obj.channelId = message.channelId); - return obj; - }, }; const baseQueryChannelClientStateResponse: object = {}; @@ -879,7 +891,9 @@ export const QueryChannelClientStateResponse = { if (message.identifiedClientState !== undefined) { IdentifiedClientState.encode(message.identifiedClientState, writer.uint32(10).fork()).ldelim(); } - writer.uint32(18).bytes(message.proof); + if (message.proof.length !== 0) { + writer.uint32(18).bytes(message.proof); + } if (message.proofHeight !== undefined) { Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); } @@ -889,7 +903,7 @@ export const QueryChannelClientStateResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryChannelClientStateResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryChannelClientStateResponse) as QueryChannelClientStateResponse; + const message = { ...baseQueryChannelClientStateResponse } as QueryChannelClientStateResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -911,7 +925,7 @@ export const QueryChannelClientStateResponse = { }, fromJSON(object: any): QueryChannelClientStateResponse { - const message = Object.create(baseQueryChannelClientStateResponse) as QueryChannelClientStateResponse; + const message = { ...baseQueryChannelClientStateResponse } as QueryChannelClientStateResponse; if (object.identifiedClientState !== undefined && object.identifiedClientState !== null) { message.identifiedClientState = IdentifiedClientState.fromJSON(object.identifiedClientState); } else { @@ -928,6 +942,19 @@ export const QueryChannelClientStateResponse = { return message; }, + toJSON(message: QueryChannelClientStateResponse): unknown { + const obj: any = {}; + message.identifiedClientState !== undefined && + (obj.identifiedClientState = message.identifiedClientState + ? IdentifiedClientState.toJSON(message.identifiedClientState) + : undefined); + message.proof !== undefined && + (obj.proof = base64FromBytes(message.proof !== undefined ? message.proof : new Uint8Array())); + message.proofHeight !== undefined && + (obj.proofHeight = message.proofHeight ? Height.toJSON(message.proofHeight) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): QueryChannelClientStateResponse { const message = { ...baseQueryChannelClientStateResponse } as QueryChannelClientStateResponse; if (object.identifiedClientState !== undefined && object.identifiedClientState !== null) { @@ -947,19 +974,6 @@ export const QueryChannelClientStateResponse = { } return message; }, - - toJSON(message: QueryChannelClientStateResponse): unknown { - const obj: any = {}; - message.identifiedClientState !== undefined && - (obj.identifiedClientState = message.identifiedClientState - ? IdentifiedClientState.toJSON(message.identifiedClientState) - : undefined); - message.proof !== undefined && - (obj.proof = base64FromBytes(message.proof !== undefined ? message.proof : new Uint8Array())); - message.proofHeight !== undefined && - (obj.proofHeight = message.proofHeight ? Height.toJSON(message.proofHeight) : undefined); - return obj; - }, }; const baseQueryChannelConsensusStateRequest: object = { @@ -971,17 +985,25 @@ const baseQueryChannelConsensusStateRequest: object = { export const QueryChannelConsensusStateRequest = { encode(message: QueryChannelConsensusStateRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.portId); - writer.uint32(18).string(message.channelId); - writer.uint32(24).uint64(message.revisionNumber); - writer.uint32(32).uint64(message.revisionHeight); + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + if (!message.revisionNumber.isZero()) { + writer.uint32(24).uint64(message.revisionNumber); + } + if (!message.revisionHeight.isZero()) { + writer.uint32(32).uint64(message.revisionHeight); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryChannelConsensusStateRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryChannelConsensusStateRequest) as QueryChannelConsensusStateRequest; + const message = { ...baseQueryChannelConsensusStateRequest } as QueryChannelConsensusStateRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1006,7 +1028,7 @@ export const QueryChannelConsensusStateRequest = { }, fromJSON(object: any): QueryChannelConsensusStateRequest { - const message = Object.create(baseQueryChannelConsensusStateRequest) as QueryChannelConsensusStateRequest; + const message = { ...baseQueryChannelConsensusStateRequest } as QueryChannelConsensusStateRequest; if (object.portId !== undefined && object.portId !== null) { message.portId = String(object.portId); } else { @@ -1030,6 +1052,17 @@ export const QueryChannelConsensusStateRequest = { return message; }, + toJSON(message: QueryChannelConsensusStateRequest): unknown { + const obj: any = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + message.revisionNumber !== undefined && + (obj.revisionNumber = (message.revisionNumber || Long.UZERO).toString()); + message.revisionHeight !== undefined && + (obj.revisionHeight = (message.revisionHeight || Long.UZERO).toString()); + return obj; + }, + fromPartial(object: DeepPartial): QueryChannelConsensusStateRequest { const message = { ...baseQueryChannelConsensusStateRequest } as QueryChannelConsensusStateRequest; if (object.portId !== undefined && object.portId !== null) { @@ -1054,17 +1087,6 @@ export const QueryChannelConsensusStateRequest = { } return message; }, - - toJSON(message: QueryChannelConsensusStateRequest): unknown { - const obj: any = {}; - message.portId !== undefined && (obj.portId = message.portId); - message.channelId !== undefined && (obj.channelId = message.channelId); - message.revisionNumber !== undefined && - (obj.revisionNumber = (message.revisionNumber || Long.UZERO).toString()); - message.revisionHeight !== undefined && - (obj.revisionHeight = (message.revisionHeight || Long.UZERO).toString()); - return obj; - }, }; const baseQueryChannelConsensusStateResponse: object = { clientId: "" }; @@ -1074,8 +1096,12 @@ export const QueryChannelConsensusStateResponse = { if (message.consensusState !== undefined) { Any.encode(message.consensusState, writer.uint32(10).fork()).ldelim(); } - writer.uint32(18).string(message.clientId); - writer.uint32(26).bytes(message.proof); + if (message.clientId !== "") { + writer.uint32(18).string(message.clientId); + } + if (message.proof.length !== 0) { + writer.uint32(26).bytes(message.proof); + } if (message.proofHeight !== undefined) { Height.encode(message.proofHeight, writer.uint32(34).fork()).ldelim(); } @@ -1085,9 +1111,7 @@ export const QueryChannelConsensusStateResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryChannelConsensusStateResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create( - baseQueryChannelConsensusStateResponse, - ) as QueryChannelConsensusStateResponse; + const message = { ...baseQueryChannelConsensusStateResponse } as QueryChannelConsensusStateResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1112,9 +1136,7 @@ export const QueryChannelConsensusStateResponse = { }, fromJSON(object: any): QueryChannelConsensusStateResponse { - const message = Object.create( - baseQueryChannelConsensusStateResponse, - ) as QueryChannelConsensusStateResponse; + const message = { ...baseQueryChannelConsensusStateResponse } as QueryChannelConsensusStateResponse; if (object.consensusState !== undefined && object.consensusState !== null) { message.consensusState = Any.fromJSON(object.consensusState); } else { @@ -1136,6 +1158,18 @@ export const QueryChannelConsensusStateResponse = { return message; }, + toJSON(message: QueryChannelConsensusStateResponse): unknown { + const obj: any = {}; + message.consensusState !== undefined && + (obj.consensusState = message.consensusState ? Any.toJSON(message.consensusState) : undefined); + message.clientId !== undefined && (obj.clientId = message.clientId); + message.proof !== undefined && + (obj.proof = base64FromBytes(message.proof !== undefined ? message.proof : new Uint8Array())); + message.proofHeight !== undefined && + (obj.proofHeight = message.proofHeight ? Height.toJSON(message.proofHeight) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): QueryChannelConsensusStateResponse { const message = { ...baseQueryChannelConsensusStateResponse } as QueryChannelConsensusStateResponse; if (object.consensusState !== undefined && object.consensusState !== null) { @@ -1160,34 +1194,28 @@ export const QueryChannelConsensusStateResponse = { } return message; }, - - toJSON(message: QueryChannelConsensusStateResponse): unknown { - const obj: any = {}; - message.consensusState !== undefined && - (obj.consensusState = message.consensusState ? Any.toJSON(message.consensusState) : undefined); - message.clientId !== undefined && (obj.clientId = message.clientId); - message.proof !== undefined && - (obj.proof = base64FromBytes(message.proof !== undefined ? message.proof : new Uint8Array())); - message.proofHeight !== undefined && - (obj.proofHeight = message.proofHeight ? Height.toJSON(message.proofHeight) : undefined); - return obj; - }, }; const baseQueryPacketCommitmentRequest: object = { portId: "", channelId: "", sequence: Long.UZERO }; export const QueryPacketCommitmentRequest = { encode(message: QueryPacketCommitmentRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.portId); - writer.uint32(18).string(message.channelId); - writer.uint32(24).uint64(message.sequence); + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + if (!message.sequence.isZero()) { + writer.uint32(24).uint64(message.sequence); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryPacketCommitmentRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryPacketCommitmentRequest) as QueryPacketCommitmentRequest; + const message = { ...baseQueryPacketCommitmentRequest } as QueryPacketCommitmentRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1209,7 +1237,7 @@ export const QueryPacketCommitmentRequest = { }, fromJSON(object: any): QueryPacketCommitmentRequest { - const message = Object.create(baseQueryPacketCommitmentRequest) as QueryPacketCommitmentRequest; + const message = { ...baseQueryPacketCommitmentRequest } as QueryPacketCommitmentRequest; if (object.portId !== undefined && object.portId !== null) { message.portId = String(object.portId); } else { @@ -1228,6 +1256,14 @@ export const QueryPacketCommitmentRequest = { return message; }, + toJSON(message: QueryPacketCommitmentRequest): unknown { + const obj: any = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + message.sequence !== undefined && (obj.sequence = (message.sequence || Long.UZERO).toString()); + return obj; + }, + fromPartial(object: DeepPartial): QueryPacketCommitmentRequest { const message = { ...baseQueryPacketCommitmentRequest } as QueryPacketCommitmentRequest; if (object.portId !== undefined && object.portId !== null) { @@ -1247,22 +1283,18 @@ export const QueryPacketCommitmentRequest = { } return message; }, - - toJSON(message: QueryPacketCommitmentRequest): unknown { - const obj: any = {}; - message.portId !== undefined && (obj.portId = message.portId); - message.channelId !== undefined && (obj.channelId = message.channelId); - message.sequence !== undefined && (obj.sequence = (message.sequence || Long.UZERO).toString()); - return obj; - }, }; const baseQueryPacketCommitmentResponse: object = {}; export const QueryPacketCommitmentResponse = { encode(message: QueryPacketCommitmentResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).bytes(message.commitment); - writer.uint32(18).bytes(message.proof); + if (message.commitment.length !== 0) { + writer.uint32(10).bytes(message.commitment); + } + if (message.proof.length !== 0) { + writer.uint32(18).bytes(message.proof); + } if (message.proofHeight !== undefined) { Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); } @@ -1272,7 +1304,7 @@ export const QueryPacketCommitmentResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryPacketCommitmentResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryPacketCommitmentResponse) as QueryPacketCommitmentResponse; + const message = { ...baseQueryPacketCommitmentResponse } as QueryPacketCommitmentResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1294,7 +1326,7 @@ export const QueryPacketCommitmentResponse = { }, fromJSON(object: any): QueryPacketCommitmentResponse { - const message = Object.create(baseQueryPacketCommitmentResponse) as QueryPacketCommitmentResponse; + const message = { ...baseQueryPacketCommitmentResponse } as QueryPacketCommitmentResponse; if (object.commitment !== undefined && object.commitment !== null) { message.commitment = bytesFromBase64(object.commitment); } @@ -1309,6 +1341,19 @@ export const QueryPacketCommitmentResponse = { return message; }, + toJSON(message: QueryPacketCommitmentResponse): unknown { + const obj: any = {}; + message.commitment !== undefined && + (obj.commitment = base64FromBytes( + message.commitment !== undefined ? message.commitment : new Uint8Array(), + )); + message.proof !== undefined && + (obj.proof = base64FromBytes(message.proof !== undefined ? message.proof : new Uint8Array())); + message.proofHeight !== undefined && + (obj.proofHeight = message.proofHeight ? Height.toJSON(message.proofHeight) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): QueryPacketCommitmentResponse { const message = { ...baseQueryPacketCommitmentResponse } as QueryPacketCommitmentResponse; if (object.commitment !== undefined && object.commitment !== null) { @@ -1328,27 +1373,18 @@ export const QueryPacketCommitmentResponse = { } return message; }, - - toJSON(message: QueryPacketCommitmentResponse): unknown { - const obj: any = {}; - message.commitment !== undefined && - (obj.commitment = base64FromBytes( - message.commitment !== undefined ? message.commitment : new Uint8Array(), - )); - message.proof !== undefined && - (obj.proof = base64FromBytes(message.proof !== undefined ? message.proof : new Uint8Array())); - message.proofHeight !== undefined && - (obj.proofHeight = message.proofHeight ? Height.toJSON(message.proofHeight) : undefined); - return obj; - }, }; const baseQueryPacketCommitmentsRequest: object = { portId: "", channelId: "" }; export const QueryPacketCommitmentsRequest = { encode(message: QueryPacketCommitmentsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.portId); - writer.uint32(18).string(message.channelId); + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(26).fork()).ldelim(); } @@ -1358,7 +1394,7 @@ export const QueryPacketCommitmentsRequest = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryPacketCommitmentsRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryPacketCommitmentsRequest) as QueryPacketCommitmentsRequest; + const message = { ...baseQueryPacketCommitmentsRequest } as QueryPacketCommitmentsRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1380,7 +1416,7 @@ export const QueryPacketCommitmentsRequest = { }, fromJSON(object: any): QueryPacketCommitmentsRequest { - const message = Object.create(baseQueryPacketCommitmentsRequest) as QueryPacketCommitmentsRequest; + const message = { ...baseQueryPacketCommitmentsRequest } as QueryPacketCommitmentsRequest; if (object.portId !== undefined && object.portId !== null) { message.portId = String(object.portId); } else { @@ -1399,6 +1435,15 @@ export const QueryPacketCommitmentsRequest = { return message; }, + toJSON(message: QueryPacketCommitmentsRequest): unknown { + const obj: any = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): QueryPacketCommitmentsRequest { const message = { ...baseQueryPacketCommitmentsRequest } as QueryPacketCommitmentsRequest; if (object.portId !== undefined && object.portId !== null) { @@ -1418,15 +1463,6 @@ export const QueryPacketCommitmentsRequest = { } return message; }, - - toJSON(message: QueryPacketCommitmentsRequest): unknown { - const obj: any = {}; - message.portId !== undefined && (obj.portId = message.portId); - message.channelId !== undefined && (obj.channelId = message.channelId); - message.pagination !== undefined && - (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); - return obj; - }, }; const baseQueryPacketCommitmentsResponse: object = {}; @@ -1448,7 +1484,7 @@ export const QueryPacketCommitmentsResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryPacketCommitmentsResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryPacketCommitmentsResponse) as QueryPacketCommitmentsResponse; + const message = { ...baseQueryPacketCommitmentsResponse } as QueryPacketCommitmentsResponse; message.commitments = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -1471,7 +1507,7 @@ export const QueryPacketCommitmentsResponse = { }, fromJSON(object: any): QueryPacketCommitmentsResponse { - const message = Object.create(baseQueryPacketCommitmentsResponse) as QueryPacketCommitmentsResponse; + const message = { ...baseQueryPacketCommitmentsResponse } as QueryPacketCommitmentsResponse; message.commitments = []; if (object.commitments !== undefined && object.commitments !== null) { for (const e of object.commitments) { @@ -1491,6 +1527,19 @@ export const QueryPacketCommitmentsResponse = { return message; }, + toJSON(message: QueryPacketCommitmentsResponse): unknown { + const obj: any = {}; + if (message.commitments) { + obj.commitments = message.commitments.map((e) => (e ? PacketState.toJSON(e) : undefined)); + } else { + obj.commitments = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + message.height !== undefined && (obj.height = message.height ? Height.toJSON(message.height) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): QueryPacketCommitmentsResponse { const message = { ...baseQueryPacketCommitmentsResponse } as QueryPacketCommitmentsResponse; message.commitments = []; @@ -1511,35 +1560,28 @@ export const QueryPacketCommitmentsResponse = { } return message; }, - - toJSON(message: QueryPacketCommitmentsResponse): unknown { - const obj: any = {}; - if (message.commitments) { - obj.commitments = message.commitments.map((e) => (e ? PacketState.toJSON(e) : undefined)); - } else { - obj.commitments = []; - } - message.pagination !== undefined && - (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); - message.height !== undefined && (obj.height = message.height ? Height.toJSON(message.height) : undefined); - return obj; - }, }; const baseQueryPacketReceiptRequest: object = { portId: "", channelId: "", sequence: Long.UZERO }; export const QueryPacketReceiptRequest = { encode(message: QueryPacketReceiptRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.portId); - writer.uint32(18).string(message.channelId); - writer.uint32(24).uint64(message.sequence); + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + if (!message.sequence.isZero()) { + writer.uint32(24).uint64(message.sequence); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryPacketReceiptRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryPacketReceiptRequest) as QueryPacketReceiptRequest; + const message = { ...baseQueryPacketReceiptRequest } as QueryPacketReceiptRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1561,7 +1603,7 @@ export const QueryPacketReceiptRequest = { }, fromJSON(object: any): QueryPacketReceiptRequest { - const message = Object.create(baseQueryPacketReceiptRequest) as QueryPacketReceiptRequest; + const message = { ...baseQueryPacketReceiptRequest } as QueryPacketReceiptRequest; if (object.portId !== undefined && object.portId !== null) { message.portId = String(object.portId); } else { @@ -1580,6 +1622,14 @@ export const QueryPacketReceiptRequest = { return message; }, + toJSON(message: QueryPacketReceiptRequest): unknown { + const obj: any = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + message.sequence !== undefined && (obj.sequence = (message.sequence || Long.UZERO).toString()); + return obj; + }, + fromPartial(object: DeepPartial): QueryPacketReceiptRequest { const message = { ...baseQueryPacketReceiptRequest } as QueryPacketReceiptRequest; if (object.portId !== undefined && object.portId !== null) { @@ -1599,22 +1649,18 @@ export const QueryPacketReceiptRequest = { } return message; }, - - toJSON(message: QueryPacketReceiptRequest): unknown { - const obj: any = {}; - message.portId !== undefined && (obj.portId = message.portId); - message.channelId !== undefined && (obj.channelId = message.channelId); - message.sequence !== undefined && (obj.sequence = (message.sequence || Long.UZERO).toString()); - return obj; - }, }; const baseQueryPacketReceiptResponse: object = { received: false }; export const QueryPacketReceiptResponse = { encode(message: QueryPacketReceiptResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(16).bool(message.received); - writer.uint32(26).bytes(message.proof); + if (message.received === true) { + writer.uint32(16).bool(message.received); + } + if (message.proof.length !== 0) { + writer.uint32(26).bytes(message.proof); + } if (message.proofHeight !== undefined) { Height.encode(message.proofHeight, writer.uint32(34).fork()).ldelim(); } @@ -1624,7 +1670,7 @@ export const QueryPacketReceiptResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryPacketReceiptResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryPacketReceiptResponse) as QueryPacketReceiptResponse; + const message = { ...baseQueryPacketReceiptResponse } as QueryPacketReceiptResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1646,7 +1692,7 @@ export const QueryPacketReceiptResponse = { }, fromJSON(object: any): QueryPacketReceiptResponse { - const message = Object.create(baseQueryPacketReceiptResponse) as QueryPacketReceiptResponse; + const message = { ...baseQueryPacketReceiptResponse } as QueryPacketReceiptResponse; if (object.received !== undefined && object.received !== null) { message.received = Boolean(object.received); } else { @@ -1663,6 +1709,16 @@ export const QueryPacketReceiptResponse = { return message; }, + toJSON(message: QueryPacketReceiptResponse): unknown { + const obj: any = {}; + message.received !== undefined && (obj.received = message.received); + message.proof !== undefined && + (obj.proof = base64FromBytes(message.proof !== undefined ? message.proof : new Uint8Array())); + message.proofHeight !== undefined && + (obj.proofHeight = message.proofHeight ? Height.toJSON(message.proofHeight) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): QueryPacketReceiptResponse { const message = { ...baseQueryPacketReceiptResponse } as QueryPacketReceiptResponse; if (object.received !== undefined && object.received !== null) { @@ -1682,32 +1738,28 @@ export const QueryPacketReceiptResponse = { } return message; }, - - toJSON(message: QueryPacketReceiptResponse): unknown { - const obj: any = {}; - message.received !== undefined && (obj.received = message.received); - message.proof !== undefined && - (obj.proof = base64FromBytes(message.proof !== undefined ? message.proof : new Uint8Array())); - message.proofHeight !== undefined && - (obj.proofHeight = message.proofHeight ? Height.toJSON(message.proofHeight) : undefined); - return obj; - }, }; const baseQueryPacketAcknowledgementRequest: object = { portId: "", channelId: "", sequence: Long.UZERO }; export const QueryPacketAcknowledgementRequest = { encode(message: QueryPacketAcknowledgementRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.portId); - writer.uint32(18).string(message.channelId); - writer.uint32(24).uint64(message.sequence); + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + if (!message.sequence.isZero()) { + writer.uint32(24).uint64(message.sequence); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryPacketAcknowledgementRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryPacketAcknowledgementRequest) as QueryPacketAcknowledgementRequest; + const message = { ...baseQueryPacketAcknowledgementRequest } as QueryPacketAcknowledgementRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1729,7 +1781,7 @@ export const QueryPacketAcknowledgementRequest = { }, fromJSON(object: any): QueryPacketAcknowledgementRequest { - const message = Object.create(baseQueryPacketAcknowledgementRequest) as QueryPacketAcknowledgementRequest; + const message = { ...baseQueryPacketAcknowledgementRequest } as QueryPacketAcknowledgementRequest; if (object.portId !== undefined && object.portId !== null) { message.portId = String(object.portId); } else { @@ -1748,6 +1800,14 @@ export const QueryPacketAcknowledgementRequest = { return message; }, + toJSON(message: QueryPacketAcknowledgementRequest): unknown { + const obj: any = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + message.sequence !== undefined && (obj.sequence = (message.sequence || Long.UZERO).toString()); + return obj; + }, + fromPartial(object: DeepPartial): QueryPacketAcknowledgementRequest { const message = { ...baseQueryPacketAcknowledgementRequest } as QueryPacketAcknowledgementRequest; if (object.portId !== undefined && object.portId !== null) { @@ -1767,22 +1827,18 @@ export const QueryPacketAcknowledgementRequest = { } return message; }, - - toJSON(message: QueryPacketAcknowledgementRequest): unknown { - const obj: any = {}; - message.portId !== undefined && (obj.portId = message.portId); - message.channelId !== undefined && (obj.channelId = message.channelId); - message.sequence !== undefined && (obj.sequence = (message.sequence || Long.UZERO).toString()); - return obj; - }, }; const baseQueryPacketAcknowledgementResponse: object = {}; export const QueryPacketAcknowledgementResponse = { encode(message: QueryPacketAcknowledgementResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).bytes(message.acknowledgement); - writer.uint32(18).bytes(message.proof); + if (message.acknowledgement.length !== 0) { + writer.uint32(10).bytes(message.acknowledgement); + } + if (message.proof.length !== 0) { + writer.uint32(18).bytes(message.proof); + } if (message.proofHeight !== undefined) { Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); } @@ -1792,9 +1848,7 @@ export const QueryPacketAcknowledgementResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryPacketAcknowledgementResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create( - baseQueryPacketAcknowledgementResponse, - ) as QueryPacketAcknowledgementResponse; + const message = { ...baseQueryPacketAcknowledgementResponse } as QueryPacketAcknowledgementResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1816,9 +1870,7 @@ export const QueryPacketAcknowledgementResponse = { }, fromJSON(object: any): QueryPacketAcknowledgementResponse { - const message = Object.create( - baseQueryPacketAcknowledgementResponse, - ) as QueryPacketAcknowledgementResponse; + const message = { ...baseQueryPacketAcknowledgementResponse } as QueryPacketAcknowledgementResponse; if (object.acknowledgement !== undefined && object.acknowledgement !== null) { message.acknowledgement = bytesFromBase64(object.acknowledgement); } @@ -1833,6 +1885,19 @@ export const QueryPacketAcknowledgementResponse = { return message; }, + toJSON(message: QueryPacketAcknowledgementResponse): unknown { + const obj: any = {}; + message.acknowledgement !== undefined && + (obj.acknowledgement = base64FromBytes( + message.acknowledgement !== undefined ? message.acknowledgement : new Uint8Array(), + )); + message.proof !== undefined && + (obj.proof = base64FromBytes(message.proof !== undefined ? message.proof : new Uint8Array())); + message.proofHeight !== undefined && + (obj.proofHeight = message.proofHeight ? Height.toJSON(message.proofHeight) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): QueryPacketAcknowledgementResponse { const message = { ...baseQueryPacketAcknowledgementResponse } as QueryPacketAcknowledgementResponse; if (object.acknowledgement !== undefined && object.acknowledgement !== null) { @@ -1852,27 +1917,18 @@ export const QueryPacketAcknowledgementResponse = { } return message; }, - - toJSON(message: QueryPacketAcknowledgementResponse): unknown { - const obj: any = {}; - message.acknowledgement !== undefined && - (obj.acknowledgement = base64FromBytes( - message.acknowledgement !== undefined ? message.acknowledgement : new Uint8Array(), - )); - message.proof !== undefined && - (obj.proof = base64FromBytes(message.proof !== undefined ? message.proof : new Uint8Array())); - message.proofHeight !== undefined && - (obj.proofHeight = message.proofHeight ? Height.toJSON(message.proofHeight) : undefined); - return obj; - }, }; const baseQueryPacketAcknowledgementsRequest: object = { portId: "", channelId: "" }; export const QueryPacketAcknowledgementsRequest = { encode(message: QueryPacketAcknowledgementsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.portId); - writer.uint32(18).string(message.channelId); + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(26).fork()).ldelim(); } @@ -1882,9 +1938,7 @@ export const QueryPacketAcknowledgementsRequest = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryPacketAcknowledgementsRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create( - baseQueryPacketAcknowledgementsRequest, - ) as QueryPacketAcknowledgementsRequest; + const message = { ...baseQueryPacketAcknowledgementsRequest } as QueryPacketAcknowledgementsRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1906,9 +1960,7 @@ export const QueryPacketAcknowledgementsRequest = { }, fromJSON(object: any): QueryPacketAcknowledgementsRequest { - const message = Object.create( - baseQueryPacketAcknowledgementsRequest, - ) as QueryPacketAcknowledgementsRequest; + const message = { ...baseQueryPacketAcknowledgementsRequest } as QueryPacketAcknowledgementsRequest; if (object.portId !== undefined && object.portId !== null) { message.portId = String(object.portId); } else { @@ -1927,6 +1979,15 @@ export const QueryPacketAcknowledgementsRequest = { return message; }, + toJSON(message: QueryPacketAcknowledgementsRequest): unknown { + const obj: any = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): QueryPacketAcknowledgementsRequest { const message = { ...baseQueryPacketAcknowledgementsRequest } as QueryPacketAcknowledgementsRequest; if (object.portId !== undefined && object.portId !== null) { @@ -1946,15 +2007,6 @@ export const QueryPacketAcknowledgementsRequest = { } return message; }, - - toJSON(message: QueryPacketAcknowledgementsRequest): unknown { - const obj: any = {}; - message.portId !== undefined && (obj.portId = message.portId); - message.channelId !== undefined && (obj.channelId = message.channelId); - message.pagination !== undefined && - (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); - return obj; - }, }; const baseQueryPacketAcknowledgementsResponse: object = {}; @@ -1976,9 +2028,7 @@ export const QueryPacketAcknowledgementsResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryPacketAcknowledgementsResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create( - baseQueryPacketAcknowledgementsResponse, - ) as QueryPacketAcknowledgementsResponse; + const message = { ...baseQueryPacketAcknowledgementsResponse } as QueryPacketAcknowledgementsResponse; message.acknowledgements = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -2001,9 +2051,7 @@ export const QueryPacketAcknowledgementsResponse = { }, fromJSON(object: any): QueryPacketAcknowledgementsResponse { - const message = Object.create( - baseQueryPacketAcknowledgementsResponse, - ) as QueryPacketAcknowledgementsResponse; + const message = { ...baseQueryPacketAcknowledgementsResponse } as QueryPacketAcknowledgementsResponse; message.acknowledgements = []; if (object.acknowledgements !== undefined && object.acknowledgements !== null) { for (const e of object.acknowledgements) { @@ -2023,6 +2071,19 @@ export const QueryPacketAcknowledgementsResponse = { return message; }, + toJSON(message: QueryPacketAcknowledgementsResponse): unknown { + const obj: any = {}; + if (message.acknowledgements) { + obj.acknowledgements = message.acknowledgements.map((e) => (e ? PacketState.toJSON(e) : undefined)); + } else { + obj.acknowledgements = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + message.height !== undefined && (obj.height = message.height ? Height.toJSON(message.height) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): QueryPacketAcknowledgementsResponse { const message = { ...baseQueryPacketAcknowledgementsResponse } as QueryPacketAcknowledgementsResponse; message.acknowledgements = []; @@ -2043,19 +2104,6 @@ export const QueryPacketAcknowledgementsResponse = { } return message; }, - - toJSON(message: QueryPacketAcknowledgementsResponse): unknown { - const obj: any = {}; - if (message.acknowledgements) { - obj.acknowledgements = message.acknowledgements.map((e) => (e ? PacketState.toJSON(e) : undefined)); - } else { - obj.acknowledgements = []; - } - message.pagination !== undefined && - (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); - message.height !== undefined && (obj.height = message.height ? Height.toJSON(message.height) : undefined); - return obj; - }, }; const baseQueryUnreceivedPacketsRequest: object = { @@ -2066,8 +2114,12 @@ const baseQueryUnreceivedPacketsRequest: object = { export const QueryUnreceivedPacketsRequest = { encode(message: QueryUnreceivedPacketsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.portId); - writer.uint32(18).string(message.channelId); + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } writer.uint32(26).fork(); for (const v of message.packetCommitmentSequences) { writer.uint64(v); @@ -2079,7 +2131,7 @@ export const QueryUnreceivedPacketsRequest = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryUnreceivedPacketsRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryUnreceivedPacketsRequest) as QueryUnreceivedPacketsRequest; + const message = { ...baseQueryUnreceivedPacketsRequest } as QueryUnreceivedPacketsRequest; message.packetCommitmentSequences = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -2109,7 +2161,7 @@ export const QueryUnreceivedPacketsRequest = { }, fromJSON(object: any): QueryUnreceivedPacketsRequest { - const message = Object.create(baseQueryUnreceivedPacketsRequest) as QueryUnreceivedPacketsRequest; + const message = { ...baseQueryUnreceivedPacketsRequest } as QueryUnreceivedPacketsRequest; message.packetCommitmentSequences = []; if (object.portId !== undefined && object.portId !== null) { message.portId = String(object.portId); @@ -2129,6 +2181,20 @@ export const QueryUnreceivedPacketsRequest = { return message; }, + toJSON(message: QueryUnreceivedPacketsRequest): unknown { + const obj: any = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + if (message.packetCommitmentSequences) { + obj.packetCommitmentSequences = message.packetCommitmentSequences.map((e) => + (e || Long.UZERO).toString(), + ); + } else { + obj.packetCommitmentSequences = []; + } + return obj; + }, + fromPartial(object: DeepPartial): QueryUnreceivedPacketsRequest { const message = { ...baseQueryUnreceivedPacketsRequest } as QueryUnreceivedPacketsRequest; message.packetCommitmentSequences = []; @@ -2149,20 +2215,6 @@ export const QueryUnreceivedPacketsRequest = { } return message; }, - - toJSON(message: QueryUnreceivedPacketsRequest): unknown { - const obj: any = {}; - message.portId !== undefined && (obj.portId = message.portId); - message.channelId !== undefined && (obj.channelId = message.channelId); - if (message.packetCommitmentSequences) { - obj.packetCommitmentSequences = message.packetCommitmentSequences.map((e) => - (e || Long.UZERO).toString(), - ); - } else { - obj.packetCommitmentSequences = []; - } - return obj; - }, }; const baseQueryUnreceivedPacketsResponse: object = { sequences: Long.UZERO }; @@ -2183,7 +2235,7 @@ export const QueryUnreceivedPacketsResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryUnreceivedPacketsResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryUnreceivedPacketsResponse) as QueryUnreceivedPacketsResponse; + const message = { ...baseQueryUnreceivedPacketsResponse } as QueryUnreceivedPacketsResponse; message.sequences = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -2210,7 +2262,7 @@ export const QueryUnreceivedPacketsResponse = { }, fromJSON(object: any): QueryUnreceivedPacketsResponse { - const message = Object.create(baseQueryUnreceivedPacketsResponse) as QueryUnreceivedPacketsResponse; + const message = { ...baseQueryUnreceivedPacketsResponse } as QueryUnreceivedPacketsResponse; message.sequences = []; if (object.sequences !== undefined && object.sequences !== null) { for (const e of object.sequences) { @@ -2225,6 +2277,17 @@ export const QueryUnreceivedPacketsResponse = { return message; }, + toJSON(message: QueryUnreceivedPacketsResponse): unknown { + const obj: any = {}; + if (message.sequences) { + obj.sequences = message.sequences.map((e) => (e || Long.UZERO).toString()); + } else { + obj.sequences = []; + } + message.height !== undefined && (obj.height = message.height ? Height.toJSON(message.height) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): QueryUnreceivedPacketsResponse { const message = { ...baseQueryUnreceivedPacketsResponse } as QueryUnreceivedPacketsResponse; message.sequences = []; @@ -2240,25 +2303,18 @@ export const QueryUnreceivedPacketsResponse = { } return message; }, - - toJSON(message: QueryUnreceivedPacketsResponse): unknown { - const obj: any = {}; - if (message.sequences) { - obj.sequences = message.sequences.map((e) => (e || Long.UZERO).toString()); - } else { - obj.sequences = []; - } - message.height !== undefined && (obj.height = message.height ? Height.toJSON(message.height) : undefined); - return obj; - }, }; const baseQueryUnreceivedAcksRequest: object = { portId: "", channelId: "", packetAckSequences: Long.UZERO }; export const QueryUnreceivedAcksRequest = { encode(message: QueryUnreceivedAcksRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.portId); - writer.uint32(18).string(message.channelId); + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } writer.uint32(26).fork(); for (const v of message.packetAckSequences) { writer.uint64(v); @@ -2270,7 +2326,7 @@ export const QueryUnreceivedAcksRequest = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryUnreceivedAcksRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryUnreceivedAcksRequest) as QueryUnreceivedAcksRequest; + const message = { ...baseQueryUnreceivedAcksRequest } as QueryUnreceivedAcksRequest; message.packetAckSequences = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -2300,7 +2356,7 @@ export const QueryUnreceivedAcksRequest = { }, fromJSON(object: any): QueryUnreceivedAcksRequest { - const message = Object.create(baseQueryUnreceivedAcksRequest) as QueryUnreceivedAcksRequest; + const message = { ...baseQueryUnreceivedAcksRequest } as QueryUnreceivedAcksRequest; message.packetAckSequences = []; if (object.portId !== undefined && object.portId !== null) { message.portId = String(object.portId); @@ -2320,6 +2376,18 @@ export const QueryUnreceivedAcksRequest = { return message; }, + toJSON(message: QueryUnreceivedAcksRequest): unknown { + const obj: any = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + if (message.packetAckSequences) { + obj.packetAckSequences = message.packetAckSequences.map((e) => (e || Long.UZERO).toString()); + } else { + obj.packetAckSequences = []; + } + return obj; + }, + fromPartial(object: DeepPartial): QueryUnreceivedAcksRequest { const message = { ...baseQueryUnreceivedAcksRequest } as QueryUnreceivedAcksRequest; message.packetAckSequences = []; @@ -2340,18 +2408,6 @@ export const QueryUnreceivedAcksRequest = { } return message; }, - - toJSON(message: QueryUnreceivedAcksRequest): unknown { - const obj: any = {}; - message.portId !== undefined && (obj.portId = message.portId); - message.channelId !== undefined && (obj.channelId = message.channelId); - if (message.packetAckSequences) { - obj.packetAckSequences = message.packetAckSequences.map((e) => (e || Long.UZERO).toString()); - } else { - obj.packetAckSequences = []; - } - return obj; - }, }; const baseQueryUnreceivedAcksResponse: object = { sequences: Long.UZERO }; @@ -2372,7 +2428,7 @@ export const QueryUnreceivedAcksResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryUnreceivedAcksResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryUnreceivedAcksResponse) as QueryUnreceivedAcksResponse; + const message = { ...baseQueryUnreceivedAcksResponse } as QueryUnreceivedAcksResponse; message.sequences = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -2399,7 +2455,7 @@ export const QueryUnreceivedAcksResponse = { }, fromJSON(object: any): QueryUnreceivedAcksResponse { - const message = Object.create(baseQueryUnreceivedAcksResponse) as QueryUnreceivedAcksResponse; + const message = { ...baseQueryUnreceivedAcksResponse } as QueryUnreceivedAcksResponse; message.sequences = []; if (object.sequences !== undefined && object.sequences !== null) { for (const e of object.sequences) { @@ -2414,6 +2470,17 @@ export const QueryUnreceivedAcksResponse = { return message; }, + toJSON(message: QueryUnreceivedAcksResponse): unknown { + const obj: any = {}; + if (message.sequences) { + obj.sequences = message.sequences.map((e) => (e || Long.UZERO).toString()); + } else { + obj.sequences = []; + } + message.height !== undefined && (obj.height = message.height ? Height.toJSON(message.height) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): QueryUnreceivedAcksResponse { const message = { ...baseQueryUnreceivedAcksResponse } as QueryUnreceivedAcksResponse; message.sequences = []; @@ -2429,32 +2496,25 @@ export const QueryUnreceivedAcksResponse = { } return message; }, - - toJSON(message: QueryUnreceivedAcksResponse): unknown { - const obj: any = {}; - if (message.sequences) { - obj.sequences = message.sequences.map((e) => (e || Long.UZERO).toString()); - } else { - obj.sequences = []; - } - message.height !== undefined && (obj.height = message.height ? Height.toJSON(message.height) : undefined); - return obj; - }, }; const baseQueryNextSequenceReceiveRequest: object = { portId: "", channelId: "" }; export const QueryNextSequenceReceiveRequest = { encode(message: QueryNextSequenceReceiveRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.portId); - writer.uint32(18).string(message.channelId); + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryNextSequenceReceiveRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryNextSequenceReceiveRequest) as QueryNextSequenceReceiveRequest; + const message = { ...baseQueryNextSequenceReceiveRequest } as QueryNextSequenceReceiveRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -2473,7 +2533,7 @@ export const QueryNextSequenceReceiveRequest = { }, fromJSON(object: any): QueryNextSequenceReceiveRequest { - const message = Object.create(baseQueryNextSequenceReceiveRequest) as QueryNextSequenceReceiveRequest; + const message = { ...baseQueryNextSequenceReceiveRequest } as QueryNextSequenceReceiveRequest; if (object.portId !== undefined && object.portId !== null) { message.portId = String(object.portId); } else { @@ -2487,6 +2547,13 @@ export const QueryNextSequenceReceiveRequest = { return message; }, + toJSON(message: QueryNextSequenceReceiveRequest): unknown { + const obj: any = {}; + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + return obj; + }, + fromPartial(object: DeepPartial): QueryNextSequenceReceiveRequest { const message = { ...baseQueryNextSequenceReceiveRequest } as QueryNextSequenceReceiveRequest; if (object.portId !== undefined && object.portId !== null) { @@ -2501,21 +2568,18 @@ export const QueryNextSequenceReceiveRequest = { } return message; }, - - toJSON(message: QueryNextSequenceReceiveRequest): unknown { - const obj: any = {}; - message.portId !== undefined && (obj.portId = message.portId); - message.channelId !== undefined && (obj.channelId = message.channelId); - return obj; - }, }; const baseQueryNextSequenceReceiveResponse: object = { nextSequenceReceive: Long.UZERO }; export const QueryNextSequenceReceiveResponse = { encode(message: QueryNextSequenceReceiveResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).uint64(message.nextSequenceReceive); - writer.uint32(18).bytes(message.proof); + if (!message.nextSequenceReceive.isZero()) { + writer.uint32(8).uint64(message.nextSequenceReceive); + } + if (message.proof.length !== 0) { + writer.uint32(18).bytes(message.proof); + } if (message.proofHeight !== undefined) { Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); } @@ -2525,7 +2589,7 @@ export const QueryNextSequenceReceiveResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryNextSequenceReceiveResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryNextSequenceReceiveResponse) as QueryNextSequenceReceiveResponse; + const message = { ...baseQueryNextSequenceReceiveResponse } as QueryNextSequenceReceiveResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -2547,7 +2611,7 @@ export const QueryNextSequenceReceiveResponse = { }, fromJSON(object: any): QueryNextSequenceReceiveResponse { - const message = Object.create(baseQueryNextSequenceReceiveResponse) as QueryNextSequenceReceiveResponse; + const message = { ...baseQueryNextSequenceReceiveResponse } as QueryNextSequenceReceiveResponse; if (object.nextSequenceReceive !== undefined && object.nextSequenceReceive !== null) { message.nextSequenceReceive = Long.fromString(object.nextSequenceReceive); } else { @@ -2564,6 +2628,17 @@ export const QueryNextSequenceReceiveResponse = { return message; }, + toJSON(message: QueryNextSequenceReceiveResponse): unknown { + const obj: any = {}; + message.nextSequenceReceive !== undefined && + (obj.nextSequenceReceive = (message.nextSequenceReceive || Long.UZERO).toString()); + message.proof !== undefined && + (obj.proof = base64FromBytes(message.proof !== undefined ? message.proof : new Uint8Array())); + message.proofHeight !== undefined && + (obj.proofHeight = message.proofHeight ? Height.toJSON(message.proofHeight) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): QueryNextSequenceReceiveResponse { const message = { ...baseQueryNextSequenceReceiveResponse } as QueryNextSequenceReceiveResponse; if (object.nextSequenceReceive !== undefined && object.nextSequenceReceive !== null) { @@ -2583,17 +2658,6 @@ export const QueryNextSequenceReceiveResponse = { } return message; }, - - toJSON(message: QueryNextSequenceReceiveResponse): unknown { - const obj: any = {}; - message.nextSequenceReceive !== undefined && - (obj.nextSequenceReceive = (message.nextSequenceReceive || Long.UZERO).toString()); - message.proof !== undefined && - (obj.proof = base64FromBytes(message.proof !== undefined ? message.proof : new Uint8Array())); - message.proofHeight !== undefined && - (obj.proofHeight = message.proofHeight ? Height.toJSON(message.proofHeight) : undefined); - return obj; - }, }; /** Query provides defines the gRPC querier service */ @@ -2754,7 +2818,7 @@ var globalThis: any = (() => { if (typeof self !== "undefined") return self; if (typeof window !== "undefined") return window; if (typeof global !== "undefined") return global; - throw new Error("Unable to locate global object"); + throw "Unable to locate global object"; })(); const atob: (b64: string) => string = diff --git a/packages/stargate/src/codec/ibc/core/client/v1/client.ts b/packages/stargate/src/codec/ibc/core/client/v1/client.ts index b0706627..b3abb226 100644 --- a/packages/stargate/src/codec/ibc/core/client/v1/client.ts +++ b/packages/stargate/src/codec/ibc/core/client/v1/client.ts @@ -79,7 +79,9 @@ const baseIdentifiedClientState: object = { clientId: "" }; export const IdentifiedClientState = { encode(message: IdentifiedClientState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.clientId); + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } if (message.clientState !== undefined) { Any.encode(message.clientState, writer.uint32(18).fork()).ldelim(); } @@ -89,7 +91,7 @@ export const IdentifiedClientState = { decode(input: _m0.Reader | Uint8Array, length?: number): IdentifiedClientState { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseIdentifiedClientState) as IdentifiedClientState; + const message = { ...baseIdentifiedClientState } as IdentifiedClientState; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -108,7 +110,7 @@ export const IdentifiedClientState = { }, fromJSON(object: any): IdentifiedClientState { - const message = Object.create(baseIdentifiedClientState) as IdentifiedClientState; + const message = { ...baseIdentifiedClientState } as IdentifiedClientState; if (object.clientId !== undefined && object.clientId !== null) { message.clientId = String(object.clientId); } else { @@ -122,6 +124,14 @@ export const IdentifiedClientState = { return message; }, + toJSON(message: IdentifiedClientState): unknown { + const obj: any = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + message.clientState !== undefined && + (obj.clientState = message.clientState ? Any.toJSON(message.clientState) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): IdentifiedClientState { const message = { ...baseIdentifiedClientState } as IdentifiedClientState; if (object.clientId !== undefined && object.clientId !== null) { @@ -136,14 +146,6 @@ export const IdentifiedClientState = { } return message; }, - - toJSON(message: IdentifiedClientState): unknown { - const obj: any = {}; - message.clientId !== undefined && (obj.clientId = message.clientId); - message.clientState !== undefined && - (obj.clientState = message.clientState ? Any.toJSON(message.clientState) : undefined); - return obj; - }, }; const baseConsensusStateWithHeight: object = {}; @@ -162,7 +164,7 @@ export const ConsensusStateWithHeight = { decode(input: _m0.Reader | Uint8Array, length?: number): ConsensusStateWithHeight { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseConsensusStateWithHeight) as ConsensusStateWithHeight; + const message = { ...baseConsensusStateWithHeight } as ConsensusStateWithHeight; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -181,7 +183,7 @@ export const ConsensusStateWithHeight = { }, fromJSON(object: any): ConsensusStateWithHeight { - const message = Object.create(baseConsensusStateWithHeight) as ConsensusStateWithHeight; + const message = { ...baseConsensusStateWithHeight } as ConsensusStateWithHeight; if (object.height !== undefined && object.height !== null) { message.height = Height.fromJSON(object.height); } else { @@ -195,6 +197,14 @@ export const ConsensusStateWithHeight = { return message; }, + toJSON(message: ConsensusStateWithHeight): unknown { + const obj: any = {}; + message.height !== undefined && (obj.height = message.height ? Height.toJSON(message.height) : undefined); + message.consensusState !== undefined && + (obj.consensusState = message.consensusState ? Any.toJSON(message.consensusState) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): ConsensusStateWithHeight { const message = { ...baseConsensusStateWithHeight } as ConsensusStateWithHeight; if (object.height !== undefined && object.height !== null) { @@ -209,21 +219,15 @@ export const ConsensusStateWithHeight = { } return message; }, - - toJSON(message: ConsensusStateWithHeight): unknown { - const obj: any = {}; - message.height !== undefined && (obj.height = message.height ? Height.toJSON(message.height) : undefined); - message.consensusState !== undefined && - (obj.consensusState = message.consensusState ? Any.toJSON(message.consensusState) : undefined); - return obj; - }, }; const baseClientConsensusStates: object = { clientId: "" }; export const ClientConsensusStates = { encode(message: ClientConsensusStates, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.clientId); + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } for (const v of message.consensusStates) { ConsensusStateWithHeight.encode(v!, writer.uint32(18).fork()).ldelim(); } @@ -233,7 +237,7 @@ export const ClientConsensusStates = { decode(input: _m0.Reader | Uint8Array, length?: number): ClientConsensusStates { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseClientConsensusStates) as ClientConsensusStates; + const message = { ...baseClientConsensusStates } as ClientConsensusStates; message.consensusStates = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -253,7 +257,7 @@ export const ClientConsensusStates = { }, fromJSON(object: any): ClientConsensusStates { - const message = Object.create(baseClientConsensusStates) as ClientConsensusStates; + const message = { ...baseClientConsensusStates } as ClientConsensusStates; message.consensusStates = []; if (object.clientId !== undefined && object.clientId !== null) { message.clientId = String(object.clientId); @@ -268,22 +272,6 @@ export const ClientConsensusStates = { return message; }, - fromPartial(object: DeepPartial): ClientConsensusStates { - const message = { ...baseClientConsensusStates } as ClientConsensusStates; - message.consensusStates = []; - if (object.clientId !== undefined && object.clientId !== null) { - message.clientId = object.clientId; - } else { - message.clientId = ""; - } - if (object.consensusStates !== undefined && object.consensusStates !== null) { - for (const e of object.consensusStates) { - message.consensusStates.push(ConsensusStateWithHeight.fromPartial(e)); - } - } - return message; - }, - toJSON(message: ClientConsensusStates): unknown { const obj: any = {}; message.clientId !== undefined && (obj.clientId = message.clientId); @@ -296,15 +284,37 @@ export const ClientConsensusStates = { } return obj; }, + + fromPartial(object: DeepPartial): ClientConsensusStates { + const message = { ...baseClientConsensusStates } as ClientConsensusStates; + message.consensusStates = []; + if (object.clientId !== undefined && object.clientId !== null) { + message.clientId = object.clientId; + } else { + message.clientId = ""; + } + if (object.consensusStates !== undefined && object.consensusStates !== null) { + for (const e of object.consensusStates) { + message.consensusStates.push(ConsensusStateWithHeight.fromPartial(e)); + } + } + return message; + }, }; const baseClientUpdateProposal: object = { title: "", description: "", clientId: "" }; export const ClientUpdateProposal = { encode(message: ClientUpdateProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.title); - writer.uint32(18).string(message.description); - writer.uint32(26).string(message.clientId); + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.clientId !== "") { + writer.uint32(26).string(message.clientId); + } if (message.header !== undefined) { Any.encode(message.header, writer.uint32(34).fork()).ldelim(); } @@ -314,7 +324,7 @@ export const ClientUpdateProposal = { decode(input: _m0.Reader | Uint8Array, length?: number): ClientUpdateProposal { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseClientUpdateProposal) as ClientUpdateProposal; + const message = { ...baseClientUpdateProposal } as ClientUpdateProposal; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -339,7 +349,7 @@ export const ClientUpdateProposal = { }, fromJSON(object: any): ClientUpdateProposal { - const message = Object.create(baseClientUpdateProposal) as ClientUpdateProposal; + const message = { ...baseClientUpdateProposal } as ClientUpdateProposal; if (object.title !== undefined && object.title !== null) { message.title = String(object.title); } else { @@ -363,6 +373,15 @@ export const ClientUpdateProposal = { return message; }, + toJSON(message: ClientUpdateProposal): unknown { + const obj: any = {}; + message.title !== undefined && (obj.title = message.title); + message.description !== undefined && (obj.description = message.description); + message.clientId !== undefined && (obj.clientId = message.clientId); + message.header !== undefined && (obj.header = message.header ? Any.toJSON(message.header) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): ClientUpdateProposal { const message = { ...baseClientUpdateProposal } as ClientUpdateProposal; if (object.title !== undefined && object.title !== null) { @@ -387,30 +406,25 @@ export const ClientUpdateProposal = { } return message; }, - - toJSON(message: ClientUpdateProposal): unknown { - const obj: any = {}; - message.title !== undefined && (obj.title = message.title); - message.description !== undefined && (obj.description = message.description); - message.clientId !== undefined && (obj.clientId = message.clientId); - message.header !== undefined && (obj.header = message.header ? Any.toJSON(message.header) : undefined); - return obj; - }, }; const baseHeight: object = { revisionNumber: Long.UZERO, revisionHeight: Long.UZERO }; export const Height = { encode(message: Height, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).uint64(message.revisionNumber); - writer.uint32(16).uint64(message.revisionHeight); + if (!message.revisionNumber.isZero()) { + writer.uint32(8).uint64(message.revisionNumber); + } + if (!message.revisionHeight.isZero()) { + writer.uint32(16).uint64(message.revisionHeight); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): Height { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseHeight) as Height; + const message = { ...baseHeight } as Height; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -429,7 +443,7 @@ export const Height = { }, fromJSON(object: any): Height { - const message = Object.create(baseHeight) as Height; + const message = { ...baseHeight } as Height; if (object.revisionNumber !== undefined && object.revisionNumber !== null) { message.revisionNumber = Long.fromString(object.revisionNumber); } else { @@ -443,6 +457,15 @@ export const Height = { return message; }, + toJSON(message: Height): unknown { + const obj: any = {}; + message.revisionNumber !== undefined && + (obj.revisionNumber = (message.revisionNumber || Long.UZERO).toString()); + message.revisionHeight !== undefined && + (obj.revisionHeight = (message.revisionHeight || Long.UZERO).toString()); + return obj; + }, + fromPartial(object: DeepPartial): Height { const message = { ...baseHeight } as Height; if (object.revisionNumber !== undefined && object.revisionNumber !== null) { @@ -457,15 +480,6 @@ export const Height = { } return message; }, - - toJSON(message: Height): unknown { - const obj: any = {}; - message.revisionNumber !== undefined && - (obj.revisionNumber = (message.revisionNumber || Long.UZERO).toString()); - message.revisionHeight !== undefined && - (obj.revisionHeight = (message.revisionHeight || Long.UZERO).toString()); - return obj; - }, }; const baseParams: object = { allowedClients: "" }; @@ -481,7 +495,7 @@ export const Params = { decode(input: _m0.Reader | Uint8Array, length?: number): Params { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseParams) as Params; + const message = { ...baseParams } as Params; message.allowedClients = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -498,22 +512,11 @@ export const Params = { }, fromJSON(object: any): Params { - const message = Object.create(baseParams) as Params; - message.allowedClients = []; - if (object.allowedClients !== undefined && object.allowedClients !== null) { - for (const e of object.allowedClients) { - message.allowedClients.push(String(e)); - } - } - return message; - }, - - fromPartial(object: DeepPartial): Params { const message = { ...baseParams } as Params; message.allowedClients = []; if (object.allowedClients !== undefined && object.allowedClients !== null) { for (const e of object.allowedClients) { - message.allowedClients.push(e); + message.allowedClients.push(String(e)); } } return message; @@ -528,6 +531,17 @@ export const Params = { } return obj; }, + + fromPartial(object: DeepPartial): Params { + const message = { ...baseParams } as Params; + message.allowedClients = []; + if (object.allowedClients !== undefined && object.allowedClients !== null) { + for (const e of object.allowedClients) { + message.allowedClients.push(e); + } + } + return message; + }, }; type Builtin = Date | Function | Uint8Array | string | number | undefined | Long; diff --git a/packages/stargate/src/codec/ibc/core/commitment/v1/commitment.ts b/packages/stargate/src/codec/ibc/core/commitment/v1/commitment.ts index 2c64b5cd..72a18bfa 100644 --- a/packages/stargate/src/codec/ibc/core/commitment/v1/commitment.ts +++ b/packages/stargate/src/codec/ibc/core/commitment/v1/commitment.ts @@ -46,14 +46,16 @@ const baseMerkleRoot: object = {}; export const MerkleRoot = { encode(message: MerkleRoot, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).bytes(message.hash); + if (message.hash.length !== 0) { + writer.uint32(10).bytes(message.hash); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): MerkleRoot { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseMerkleRoot) as MerkleRoot; + const message = { ...baseMerkleRoot } as MerkleRoot; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -69,13 +71,20 @@ export const MerkleRoot = { }, fromJSON(object: any): MerkleRoot { - const message = Object.create(baseMerkleRoot) as MerkleRoot; + const message = { ...baseMerkleRoot } as MerkleRoot; if (object.hash !== undefined && object.hash !== null) { message.hash = bytesFromBase64(object.hash); } return message; }, + toJSON(message: MerkleRoot): unknown { + const obj: any = {}; + message.hash !== undefined && + (obj.hash = base64FromBytes(message.hash !== undefined ? message.hash : new Uint8Array())); + return obj; + }, + fromPartial(object: DeepPartial): MerkleRoot { const message = { ...baseMerkleRoot } as MerkleRoot; if (object.hash !== undefined && object.hash !== null) { @@ -85,27 +94,22 @@ export const MerkleRoot = { } return message; }, - - toJSON(message: MerkleRoot): unknown { - const obj: any = {}; - message.hash !== undefined && - (obj.hash = base64FromBytes(message.hash !== undefined ? message.hash : new Uint8Array())); - return obj; - }, }; const baseMerklePrefix: object = {}; export const MerklePrefix = { encode(message: MerklePrefix, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).bytes(message.keyPrefix); + if (message.keyPrefix.length !== 0) { + writer.uint32(10).bytes(message.keyPrefix); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): MerklePrefix { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseMerklePrefix) as MerklePrefix; + const message = { ...baseMerklePrefix } as MerklePrefix; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -121,19 +125,9 @@ export const MerklePrefix = { }, fromJSON(object: any): MerklePrefix { - const message = Object.create(baseMerklePrefix) as MerklePrefix; - if (object.keyPrefix !== undefined && object.keyPrefix !== null) { - message.keyPrefix = bytesFromBase64(object.keyPrefix); - } - return message; - }, - - fromPartial(object: DeepPartial): MerklePrefix { const message = { ...baseMerklePrefix } as MerklePrefix; if (object.keyPrefix !== undefined && object.keyPrefix !== null) { - message.keyPrefix = object.keyPrefix; - } else { - message.keyPrefix = new Uint8Array(); + message.keyPrefix = bytesFromBase64(object.keyPrefix); } return message; }, @@ -146,6 +140,16 @@ export const MerklePrefix = { )); return obj; }, + + fromPartial(object: DeepPartial): MerklePrefix { + const message = { ...baseMerklePrefix } as MerklePrefix; + if (object.keyPrefix !== undefined && object.keyPrefix !== null) { + message.keyPrefix = object.keyPrefix; + } else { + message.keyPrefix = new Uint8Array(); + } + return message; + }, }; const baseMerklePath: object = { keyPath: "" }; @@ -161,7 +165,7 @@ export const MerklePath = { decode(input: _m0.Reader | Uint8Array, length?: number): MerklePath { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseMerklePath) as MerklePath; + const message = { ...baseMerklePath } as MerklePath; message.keyPath = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -178,22 +182,11 @@ export const MerklePath = { }, fromJSON(object: any): MerklePath { - const message = Object.create(baseMerklePath) as MerklePath; - message.keyPath = []; - if (object.keyPath !== undefined && object.keyPath !== null) { - for (const e of object.keyPath) { - message.keyPath.push(String(e)); - } - } - return message; - }, - - fromPartial(object: DeepPartial): MerklePath { const message = { ...baseMerklePath } as MerklePath; message.keyPath = []; if (object.keyPath !== undefined && object.keyPath !== null) { for (const e of object.keyPath) { - message.keyPath.push(e); + message.keyPath.push(String(e)); } } return message; @@ -208,6 +201,17 @@ export const MerklePath = { } return obj; }, + + fromPartial(object: DeepPartial): MerklePath { + const message = { ...baseMerklePath } as MerklePath; + message.keyPath = []; + if (object.keyPath !== undefined && object.keyPath !== null) { + for (const e of object.keyPath) { + message.keyPath.push(e); + } + } + return message; + }, }; const baseMerkleProof: object = {}; @@ -223,7 +227,7 @@ export const MerkleProof = { decode(input: _m0.Reader | Uint8Array, length?: number): MerkleProof { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseMerkleProof) as MerkleProof; + const message = { ...baseMerkleProof } as MerkleProof; message.proofs = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -240,22 +244,11 @@ export const MerkleProof = { }, fromJSON(object: any): MerkleProof { - const message = Object.create(baseMerkleProof) as MerkleProof; - message.proofs = []; - if (object.proofs !== undefined && object.proofs !== null) { - for (const e of object.proofs) { - message.proofs.push(CommitmentProof.fromJSON(e)); - } - } - return message; - }, - - fromPartial(object: DeepPartial): MerkleProof { const message = { ...baseMerkleProof } as MerkleProof; message.proofs = []; if (object.proofs !== undefined && object.proofs !== null) { for (const e of object.proofs) { - message.proofs.push(CommitmentProof.fromPartial(e)); + message.proofs.push(CommitmentProof.fromJSON(e)); } } return message; @@ -270,6 +263,17 @@ export const MerkleProof = { } return obj; }, + + fromPartial(object: DeepPartial): MerkleProof { + const message = { ...baseMerkleProof } as MerkleProof; + message.proofs = []; + if (object.proofs !== undefined && object.proofs !== null) { + for (const e of object.proofs) { + message.proofs.push(CommitmentProof.fromPartial(e)); + } + } + return message; + }, }; declare var self: any | undefined; @@ -279,7 +283,7 @@ var globalThis: any = (() => { if (typeof self !== "undefined") return self; if (typeof window !== "undefined") return window; if (typeof global !== "undefined") return global; - throw new Error("Unable to locate global object"); + throw "Unable to locate global object"; })(); const atob: (b64: string) => string = diff --git a/packages/stargate/src/codec/ibc/core/connection/v1/connection.ts b/packages/stargate/src/codec/ibc/core/connection/v1/connection.ts index 255fc10a..b060bbb8 100644 --- a/packages/stargate/src/codec/ibc/core/connection/v1/connection.ts +++ b/packages/stargate/src/codec/ibc/core/connection/v1/connection.ts @@ -152,22 +152,28 @@ const baseConnectionEnd: object = { clientId: "", state: 0, delayPeriod: Long.UZ export const ConnectionEnd = { encode(message: ConnectionEnd, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.clientId); + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } for (const v of message.versions) { Version.encode(v!, writer.uint32(18).fork()).ldelim(); } - writer.uint32(24).int32(message.state); + if (message.state !== 0) { + writer.uint32(24).int32(message.state); + } if (message.counterparty !== undefined) { Counterparty.encode(message.counterparty, writer.uint32(34).fork()).ldelim(); } - writer.uint32(40).uint64(message.delayPeriod); + if (!message.delayPeriod.isZero()) { + writer.uint32(40).uint64(message.delayPeriod); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): ConnectionEnd { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseConnectionEnd) as ConnectionEnd; + const message = { ...baseConnectionEnd } as ConnectionEnd; message.versions = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -196,7 +202,7 @@ export const ConnectionEnd = { }, fromJSON(object: any): ConnectionEnd { - const message = Object.create(baseConnectionEnd) as ConnectionEnd; + const message = { ...baseConnectionEnd } as ConnectionEnd; message.versions = []; if (object.clientId !== undefined && object.clientId !== null) { message.clientId = String(object.clientId); @@ -226,6 +232,21 @@ export const ConnectionEnd = { return message; }, + toJSON(message: ConnectionEnd): unknown { + const obj: any = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + if (message.versions) { + obj.versions = message.versions.map((e) => (e ? Version.toJSON(e) : undefined)); + } else { + obj.versions = []; + } + message.state !== undefined && (obj.state = stateToJSON(message.state)); + message.counterparty !== undefined && + (obj.counterparty = message.counterparty ? Counterparty.toJSON(message.counterparty) : undefined); + message.delayPeriod !== undefined && (obj.delayPeriod = (message.delayPeriod || Long.UZERO).toString()); + return obj; + }, + fromPartial(object: DeepPartial): ConnectionEnd { const message = { ...baseConnectionEnd } as ConnectionEnd; message.versions = []; @@ -256,44 +277,37 @@ export const ConnectionEnd = { } return message; }, - - toJSON(message: ConnectionEnd): unknown { - const obj: any = {}; - message.clientId !== undefined && (obj.clientId = message.clientId); - if (message.versions) { - obj.versions = message.versions.map((e) => (e ? Version.toJSON(e) : undefined)); - } else { - obj.versions = []; - } - message.state !== undefined && (obj.state = stateToJSON(message.state)); - message.counterparty !== undefined && - (obj.counterparty = message.counterparty ? Counterparty.toJSON(message.counterparty) : undefined); - message.delayPeriod !== undefined && (obj.delayPeriod = (message.delayPeriod || Long.UZERO).toString()); - return obj; - }, }; const baseIdentifiedConnection: object = { id: "", clientId: "", state: 0, delayPeriod: Long.UZERO }; export const IdentifiedConnection = { encode(message: IdentifiedConnection, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.id); - writer.uint32(18).string(message.clientId); + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + if (message.clientId !== "") { + writer.uint32(18).string(message.clientId); + } for (const v of message.versions) { Version.encode(v!, writer.uint32(26).fork()).ldelim(); } - writer.uint32(32).int32(message.state); + if (message.state !== 0) { + writer.uint32(32).int32(message.state); + } if (message.counterparty !== undefined) { Counterparty.encode(message.counterparty, writer.uint32(42).fork()).ldelim(); } - writer.uint32(48).uint64(message.delayPeriod); + if (!message.delayPeriod.isZero()) { + writer.uint32(48).uint64(message.delayPeriod); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): IdentifiedConnection { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseIdentifiedConnection) as IdentifiedConnection; + const message = { ...baseIdentifiedConnection } as IdentifiedConnection; message.versions = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -325,7 +339,7 @@ export const IdentifiedConnection = { }, fromJSON(object: any): IdentifiedConnection { - const message = Object.create(baseIdentifiedConnection) as IdentifiedConnection; + const message = { ...baseIdentifiedConnection } as IdentifiedConnection; message.versions = []; if (object.id !== undefined && object.id !== null) { message.id = String(object.id); @@ -360,6 +374,22 @@ export const IdentifiedConnection = { return message; }, + toJSON(message: IdentifiedConnection): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = message.id); + message.clientId !== undefined && (obj.clientId = message.clientId); + if (message.versions) { + obj.versions = message.versions.map((e) => (e ? Version.toJSON(e) : undefined)); + } else { + obj.versions = []; + } + message.state !== undefined && (obj.state = stateToJSON(message.state)); + message.counterparty !== undefined && + (obj.counterparty = message.counterparty ? Counterparty.toJSON(message.counterparty) : undefined); + message.delayPeriod !== undefined && (obj.delayPeriod = (message.delayPeriod || Long.UZERO).toString()); + return obj; + }, + fromPartial(object: DeepPartial): IdentifiedConnection { const message = { ...baseIdentifiedConnection } as IdentifiedConnection; message.versions = []; @@ -395,30 +425,18 @@ export const IdentifiedConnection = { } return message; }, - - toJSON(message: IdentifiedConnection): unknown { - const obj: any = {}; - message.id !== undefined && (obj.id = message.id); - message.clientId !== undefined && (obj.clientId = message.clientId); - if (message.versions) { - obj.versions = message.versions.map((e) => (e ? Version.toJSON(e) : undefined)); - } else { - obj.versions = []; - } - message.state !== undefined && (obj.state = stateToJSON(message.state)); - message.counterparty !== undefined && - (obj.counterparty = message.counterparty ? Counterparty.toJSON(message.counterparty) : undefined); - message.delayPeriod !== undefined && (obj.delayPeriod = (message.delayPeriod || Long.UZERO).toString()); - return obj; - }, }; const baseCounterparty: object = { clientId: "", connectionId: "" }; export const Counterparty = { encode(message: Counterparty, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.clientId); - writer.uint32(18).string(message.connectionId); + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } if (message.prefix !== undefined) { MerklePrefix.encode(message.prefix, writer.uint32(26).fork()).ldelim(); } @@ -428,7 +446,7 @@ export const Counterparty = { decode(input: _m0.Reader | Uint8Array, length?: number): Counterparty { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseCounterparty) as Counterparty; + const message = { ...baseCounterparty } as Counterparty; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -450,7 +468,7 @@ export const Counterparty = { }, fromJSON(object: any): Counterparty { - const message = Object.create(baseCounterparty) as Counterparty; + const message = { ...baseCounterparty } as Counterparty; if (object.clientId !== undefined && object.clientId !== null) { message.clientId = String(object.clientId); } else { @@ -469,6 +487,15 @@ export const Counterparty = { return message; }, + toJSON(message: Counterparty): unknown { + const obj: any = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + message.connectionId !== undefined && (obj.connectionId = message.connectionId); + message.prefix !== undefined && + (obj.prefix = message.prefix ? MerklePrefix.toJSON(message.prefix) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): Counterparty { const message = { ...baseCounterparty } as Counterparty; if (object.clientId !== undefined && object.clientId !== null) { @@ -488,15 +515,6 @@ export const Counterparty = { } return message; }, - - toJSON(message: Counterparty): unknown { - const obj: any = {}; - message.clientId !== undefined && (obj.clientId = message.clientId); - message.connectionId !== undefined && (obj.connectionId = message.connectionId); - message.prefix !== undefined && - (obj.prefix = message.prefix ? MerklePrefix.toJSON(message.prefix) : undefined); - return obj; - }, }; const baseClientPaths: object = { paths: "" }; @@ -512,7 +530,7 @@ export const ClientPaths = { decode(input: _m0.Reader | Uint8Array, length?: number): ClientPaths { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseClientPaths) as ClientPaths; + const message = { ...baseClientPaths } as ClientPaths; message.paths = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -529,22 +547,11 @@ export const ClientPaths = { }, fromJSON(object: any): ClientPaths { - const message = Object.create(baseClientPaths) as ClientPaths; - message.paths = []; - if (object.paths !== undefined && object.paths !== null) { - for (const e of object.paths) { - message.paths.push(String(e)); - } - } - return message; - }, - - fromPartial(object: DeepPartial): ClientPaths { const message = { ...baseClientPaths } as ClientPaths; message.paths = []; if (object.paths !== undefined && object.paths !== null) { for (const e of object.paths) { - message.paths.push(e); + message.paths.push(String(e)); } } return message; @@ -559,13 +566,26 @@ export const ClientPaths = { } return obj; }, + + fromPartial(object: DeepPartial): ClientPaths { + const message = { ...baseClientPaths } as ClientPaths; + message.paths = []; + if (object.paths !== undefined && object.paths !== null) { + for (const e of object.paths) { + message.paths.push(e); + } + } + return message; + }, }; const baseConnectionPaths: object = { clientId: "", paths: "" }; export const ConnectionPaths = { encode(message: ConnectionPaths, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.clientId); + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } for (const v of message.paths) { writer.uint32(18).string(v!); } @@ -575,7 +595,7 @@ export const ConnectionPaths = { decode(input: _m0.Reader | Uint8Array, length?: number): ConnectionPaths { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseConnectionPaths) as ConnectionPaths; + const message = { ...baseConnectionPaths } as ConnectionPaths; message.paths = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -595,7 +615,7 @@ export const ConnectionPaths = { }, fromJSON(object: any): ConnectionPaths { - const message = Object.create(baseConnectionPaths) as ConnectionPaths; + const message = { ...baseConnectionPaths } as ConnectionPaths; message.paths = []; if (object.clientId !== undefined && object.clientId !== null) { message.clientId = String(object.clientId); @@ -610,6 +630,17 @@ export const ConnectionPaths = { return message; }, + toJSON(message: ConnectionPaths): unknown { + const obj: any = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + if (message.paths) { + obj.paths = message.paths.map((e) => e); + } else { + obj.paths = []; + } + return obj; + }, + fromPartial(object: DeepPartial): ConnectionPaths { const message = { ...baseConnectionPaths } as ConnectionPaths; message.paths = []; @@ -625,24 +656,15 @@ export const ConnectionPaths = { } return message; }, - - toJSON(message: ConnectionPaths): unknown { - const obj: any = {}; - message.clientId !== undefined && (obj.clientId = message.clientId); - if (message.paths) { - obj.paths = message.paths.map((e) => e); - } else { - obj.paths = []; - } - return obj; - }, }; const baseVersion: object = { identifier: "", features: "" }; export const Version = { encode(message: Version, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.identifier); + if (message.identifier !== "") { + writer.uint32(10).string(message.identifier); + } for (const v of message.features) { writer.uint32(18).string(v!); } @@ -652,7 +674,7 @@ export const Version = { decode(input: _m0.Reader | Uint8Array, length?: number): Version { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseVersion) as Version; + const message = { ...baseVersion } as Version; message.features = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -672,7 +694,7 @@ export const Version = { }, fromJSON(object: any): Version { - const message = Object.create(baseVersion) as Version; + const message = { ...baseVersion } as Version; message.features = []; if (object.identifier !== undefined && object.identifier !== null) { message.identifier = String(object.identifier); @@ -687,6 +709,17 @@ export const Version = { return message; }, + toJSON(message: Version): unknown { + const obj: any = {}; + message.identifier !== undefined && (obj.identifier = message.identifier); + if (message.features) { + obj.features = message.features.map((e) => e); + } else { + obj.features = []; + } + return obj; + }, + fromPartial(object: DeepPartial): Version { const message = { ...baseVersion } as Version; message.features = []; @@ -702,17 +735,6 @@ export const Version = { } return message; }, - - toJSON(message: Version): unknown { - const obj: any = {}; - message.identifier !== undefined && (obj.identifier = message.identifier); - if (message.features) { - obj.features = message.features.map((e) => e); - } else { - obj.features = []; - } - return obj; - }, }; type Builtin = Date | Function | Uint8Array | string | number | undefined | Long; diff --git a/packages/stargate/src/codec/ibc/core/connection/v1/query.ts b/packages/stargate/src/codec/ibc/core/connection/v1/query.ts index c8089f63..3a1fdb36 100644 --- a/packages/stargate/src/codec/ibc/core/connection/v1/query.ts +++ b/packages/stargate/src/codec/ibc/core/connection/v1/query.ts @@ -126,14 +126,16 @@ const baseQueryConnectionRequest: object = { connectionId: "" }; export const QueryConnectionRequest = { encode(message: QueryConnectionRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.connectionId); + if (message.connectionId !== "") { + writer.uint32(10).string(message.connectionId); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryConnectionRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryConnectionRequest) as QueryConnectionRequest; + const message = { ...baseQueryConnectionRequest } as QueryConnectionRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -149,19 +151,9 @@ export const QueryConnectionRequest = { }, fromJSON(object: any): QueryConnectionRequest { - const message = Object.create(baseQueryConnectionRequest) as QueryConnectionRequest; - if (object.connectionId !== undefined && object.connectionId !== null) { - message.connectionId = String(object.connectionId); - } else { - message.connectionId = ""; - } - return message; - }, - - fromPartial(object: DeepPartial): QueryConnectionRequest { const message = { ...baseQueryConnectionRequest } as QueryConnectionRequest; if (object.connectionId !== undefined && object.connectionId !== null) { - message.connectionId = object.connectionId; + message.connectionId = String(object.connectionId); } else { message.connectionId = ""; } @@ -173,6 +165,16 @@ export const QueryConnectionRequest = { message.connectionId !== undefined && (obj.connectionId = message.connectionId); return obj; }, + + fromPartial(object: DeepPartial): QueryConnectionRequest { + const message = { ...baseQueryConnectionRequest } as QueryConnectionRequest; + if (object.connectionId !== undefined && object.connectionId !== null) { + message.connectionId = object.connectionId; + } else { + message.connectionId = ""; + } + return message; + }, }; const baseQueryConnectionResponse: object = {}; @@ -182,7 +184,9 @@ export const QueryConnectionResponse = { if (message.connection !== undefined) { ConnectionEnd.encode(message.connection, writer.uint32(10).fork()).ldelim(); } - writer.uint32(18).bytes(message.proof); + if (message.proof.length !== 0) { + writer.uint32(18).bytes(message.proof); + } if (message.proofHeight !== undefined) { Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); } @@ -192,7 +196,7 @@ export const QueryConnectionResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryConnectionResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryConnectionResponse) as QueryConnectionResponse; + const message = { ...baseQueryConnectionResponse } as QueryConnectionResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -214,7 +218,7 @@ export const QueryConnectionResponse = { }, fromJSON(object: any): QueryConnectionResponse { - const message = Object.create(baseQueryConnectionResponse) as QueryConnectionResponse; + const message = { ...baseQueryConnectionResponse } as QueryConnectionResponse; if (object.connection !== undefined && object.connection !== null) { message.connection = ConnectionEnd.fromJSON(object.connection); } else { @@ -231,6 +235,17 @@ export const QueryConnectionResponse = { return message; }, + toJSON(message: QueryConnectionResponse): unknown { + const obj: any = {}; + message.connection !== undefined && + (obj.connection = message.connection ? ConnectionEnd.toJSON(message.connection) : undefined); + message.proof !== undefined && + (obj.proof = base64FromBytes(message.proof !== undefined ? message.proof : new Uint8Array())); + message.proofHeight !== undefined && + (obj.proofHeight = message.proofHeight ? Height.toJSON(message.proofHeight) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): QueryConnectionResponse { const message = { ...baseQueryConnectionResponse } as QueryConnectionResponse; if (object.connection !== undefined && object.connection !== null) { @@ -250,17 +265,6 @@ export const QueryConnectionResponse = { } return message; }, - - toJSON(message: QueryConnectionResponse): unknown { - const obj: any = {}; - message.connection !== undefined && - (obj.connection = message.connection ? ConnectionEnd.toJSON(message.connection) : undefined); - message.proof !== undefined && - (obj.proof = base64FromBytes(message.proof !== undefined ? message.proof : new Uint8Array())); - message.proofHeight !== undefined && - (obj.proofHeight = message.proofHeight ? Height.toJSON(message.proofHeight) : undefined); - return obj; - }, }; const baseQueryConnectionsRequest: object = {}; @@ -276,7 +280,7 @@ export const QueryConnectionsRequest = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryConnectionsRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryConnectionsRequest) as QueryConnectionsRequest; + const message = { ...baseQueryConnectionsRequest } as QueryConnectionsRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -292,19 +296,9 @@ export const QueryConnectionsRequest = { }, fromJSON(object: any): QueryConnectionsRequest { - const message = Object.create(baseQueryConnectionsRequest) as QueryConnectionsRequest; - if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageRequest.fromJSON(object.pagination); - } else { - message.pagination = undefined; - } - return message; - }, - - fromPartial(object: DeepPartial): QueryConnectionsRequest { const message = { ...baseQueryConnectionsRequest } as QueryConnectionsRequest; if (object.pagination !== undefined && object.pagination !== null) { - message.pagination = PageRequest.fromPartial(object.pagination); + message.pagination = PageRequest.fromJSON(object.pagination); } else { message.pagination = undefined; } @@ -317,6 +311,16 @@ export const QueryConnectionsRequest = { (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); return obj; }, + + fromPartial(object: DeepPartial): QueryConnectionsRequest { + const message = { ...baseQueryConnectionsRequest } as QueryConnectionsRequest; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromPartial(object.pagination); + } else { + message.pagination = undefined; + } + return message; + }, }; const baseQueryConnectionsResponse: object = {}; @@ -338,7 +342,7 @@ export const QueryConnectionsResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryConnectionsResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryConnectionsResponse) as QueryConnectionsResponse; + const message = { ...baseQueryConnectionsResponse } as QueryConnectionsResponse; message.connections = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -361,7 +365,7 @@ export const QueryConnectionsResponse = { }, fromJSON(object: any): QueryConnectionsResponse { - const message = Object.create(baseQueryConnectionsResponse) as QueryConnectionsResponse; + const message = { ...baseQueryConnectionsResponse } as QueryConnectionsResponse; message.connections = []; if (object.connections !== undefined && object.connections !== null) { for (const e of object.connections) { @@ -381,6 +385,19 @@ export const QueryConnectionsResponse = { return message; }, + toJSON(message: QueryConnectionsResponse): unknown { + const obj: any = {}; + if (message.connections) { + obj.connections = message.connections.map((e) => (e ? IdentifiedConnection.toJSON(e) : undefined)); + } else { + obj.connections = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); + message.height !== undefined && (obj.height = message.height ? Height.toJSON(message.height) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): QueryConnectionsResponse { const message = { ...baseQueryConnectionsResponse } as QueryConnectionsResponse; message.connections = []; @@ -401,33 +418,22 @@ export const QueryConnectionsResponse = { } return message; }, - - toJSON(message: QueryConnectionsResponse): unknown { - const obj: any = {}; - if (message.connections) { - obj.connections = message.connections.map((e) => (e ? IdentifiedConnection.toJSON(e) : undefined)); - } else { - obj.connections = []; - } - message.pagination !== undefined && - (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); - message.height !== undefined && (obj.height = message.height ? Height.toJSON(message.height) : undefined); - return obj; - }, }; const baseQueryClientConnectionsRequest: object = { clientId: "" }; export const QueryClientConnectionsRequest = { encode(message: QueryClientConnectionsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.clientId); + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryClientConnectionsRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryClientConnectionsRequest) as QueryClientConnectionsRequest; + const message = { ...baseQueryClientConnectionsRequest } as QueryClientConnectionsRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -443,19 +449,9 @@ export const QueryClientConnectionsRequest = { }, fromJSON(object: any): QueryClientConnectionsRequest { - const message = Object.create(baseQueryClientConnectionsRequest) as QueryClientConnectionsRequest; - if (object.clientId !== undefined && object.clientId !== null) { - message.clientId = String(object.clientId); - } else { - message.clientId = ""; - } - return message; - }, - - fromPartial(object: DeepPartial): QueryClientConnectionsRequest { const message = { ...baseQueryClientConnectionsRequest } as QueryClientConnectionsRequest; if (object.clientId !== undefined && object.clientId !== null) { - message.clientId = object.clientId; + message.clientId = String(object.clientId); } else { message.clientId = ""; } @@ -467,6 +463,16 @@ export const QueryClientConnectionsRequest = { message.clientId !== undefined && (obj.clientId = message.clientId); return obj; }, + + fromPartial(object: DeepPartial): QueryClientConnectionsRequest { + const message = { ...baseQueryClientConnectionsRequest } as QueryClientConnectionsRequest; + if (object.clientId !== undefined && object.clientId !== null) { + message.clientId = object.clientId; + } else { + message.clientId = ""; + } + return message; + }, }; const baseQueryClientConnectionsResponse: object = { connectionPaths: "" }; @@ -476,7 +482,9 @@ export const QueryClientConnectionsResponse = { for (const v of message.connectionPaths) { writer.uint32(10).string(v!); } - writer.uint32(18).bytes(message.proof); + if (message.proof.length !== 0) { + writer.uint32(18).bytes(message.proof); + } if (message.proofHeight !== undefined) { Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); } @@ -486,7 +494,7 @@ export const QueryClientConnectionsResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryClientConnectionsResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryClientConnectionsResponse) as QueryClientConnectionsResponse; + const message = { ...baseQueryClientConnectionsResponse } as QueryClientConnectionsResponse; message.connectionPaths = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -509,7 +517,7 @@ export const QueryClientConnectionsResponse = { }, fromJSON(object: any): QueryClientConnectionsResponse { - const message = Object.create(baseQueryClientConnectionsResponse) as QueryClientConnectionsResponse; + const message = { ...baseQueryClientConnectionsResponse } as QueryClientConnectionsResponse; message.connectionPaths = []; if (object.connectionPaths !== undefined && object.connectionPaths !== null) { for (const e of object.connectionPaths) { @@ -527,6 +535,20 @@ export const QueryClientConnectionsResponse = { return message; }, + toJSON(message: QueryClientConnectionsResponse): unknown { + const obj: any = {}; + if (message.connectionPaths) { + obj.connectionPaths = message.connectionPaths.map((e) => e); + } else { + obj.connectionPaths = []; + } + message.proof !== undefined && + (obj.proof = base64FromBytes(message.proof !== undefined ? message.proof : new Uint8Array())); + message.proofHeight !== undefined && + (obj.proofHeight = message.proofHeight ? Height.toJSON(message.proofHeight) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): QueryClientConnectionsResponse { const message = { ...baseQueryClientConnectionsResponse } as QueryClientConnectionsResponse; message.connectionPaths = []; @@ -547,34 +569,22 @@ export const QueryClientConnectionsResponse = { } return message; }, - - toJSON(message: QueryClientConnectionsResponse): unknown { - const obj: any = {}; - if (message.connectionPaths) { - obj.connectionPaths = message.connectionPaths.map((e) => e); - } else { - obj.connectionPaths = []; - } - message.proof !== undefined && - (obj.proof = base64FromBytes(message.proof !== undefined ? message.proof : new Uint8Array())); - message.proofHeight !== undefined && - (obj.proofHeight = message.proofHeight ? Height.toJSON(message.proofHeight) : undefined); - return obj; - }, }; const baseQueryConnectionClientStateRequest: object = { connectionId: "" }; export const QueryConnectionClientStateRequest = { encode(message: QueryConnectionClientStateRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.connectionId); + if (message.connectionId !== "") { + writer.uint32(10).string(message.connectionId); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryConnectionClientStateRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseQueryConnectionClientStateRequest) as QueryConnectionClientStateRequest; + const message = { ...baseQueryConnectionClientStateRequest } as QueryConnectionClientStateRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -590,19 +600,9 @@ export const QueryConnectionClientStateRequest = { }, fromJSON(object: any): QueryConnectionClientStateRequest { - const message = Object.create(baseQueryConnectionClientStateRequest) as QueryConnectionClientStateRequest; - if (object.connectionId !== undefined && object.connectionId !== null) { - message.connectionId = String(object.connectionId); - } else { - message.connectionId = ""; - } - return message; - }, - - fromPartial(object: DeepPartial): QueryConnectionClientStateRequest { const message = { ...baseQueryConnectionClientStateRequest } as QueryConnectionClientStateRequest; if (object.connectionId !== undefined && object.connectionId !== null) { - message.connectionId = object.connectionId; + message.connectionId = String(object.connectionId); } else { message.connectionId = ""; } @@ -614,6 +614,16 @@ export const QueryConnectionClientStateRequest = { message.connectionId !== undefined && (obj.connectionId = message.connectionId); return obj; }, + + fromPartial(object: DeepPartial): QueryConnectionClientStateRequest { + const message = { ...baseQueryConnectionClientStateRequest } as QueryConnectionClientStateRequest; + if (object.connectionId !== undefined && object.connectionId !== null) { + message.connectionId = object.connectionId; + } else { + message.connectionId = ""; + } + return message; + }, }; const baseQueryConnectionClientStateResponse: object = {}; @@ -623,7 +633,9 @@ export const QueryConnectionClientStateResponse = { if (message.identifiedClientState !== undefined) { IdentifiedClientState.encode(message.identifiedClientState, writer.uint32(10).fork()).ldelim(); } - writer.uint32(18).bytes(message.proof); + if (message.proof.length !== 0) { + writer.uint32(18).bytes(message.proof); + } if (message.proofHeight !== undefined) { Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); } @@ -633,9 +645,7 @@ export const QueryConnectionClientStateResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryConnectionClientStateResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create( - baseQueryConnectionClientStateResponse, - ) as QueryConnectionClientStateResponse; + const message = { ...baseQueryConnectionClientStateResponse } as QueryConnectionClientStateResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -657,9 +667,7 @@ export const QueryConnectionClientStateResponse = { }, fromJSON(object: any): QueryConnectionClientStateResponse { - const message = Object.create( - baseQueryConnectionClientStateResponse, - ) as QueryConnectionClientStateResponse; + const message = { ...baseQueryConnectionClientStateResponse } as QueryConnectionClientStateResponse; if (object.identifiedClientState !== undefined && object.identifiedClientState !== null) { message.identifiedClientState = IdentifiedClientState.fromJSON(object.identifiedClientState); } else { @@ -676,6 +684,19 @@ export const QueryConnectionClientStateResponse = { return message; }, + toJSON(message: QueryConnectionClientStateResponse): unknown { + const obj: any = {}; + message.identifiedClientState !== undefined && + (obj.identifiedClientState = message.identifiedClientState + ? IdentifiedClientState.toJSON(message.identifiedClientState) + : undefined); + message.proof !== undefined && + (obj.proof = base64FromBytes(message.proof !== undefined ? message.proof : new Uint8Array())); + message.proofHeight !== undefined && + (obj.proofHeight = message.proofHeight ? Height.toJSON(message.proofHeight) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): QueryConnectionClientStateResponse { const message = { ...baseQueryConnectionClientStateResponse } as QueryConnectionClientStateResponse; if (object.identifiedClientState !== undefined && object.identifiedClientState !== null) { @@ -695,19 +716,6 @@ export const QueryConnectionClientStateResponse = { } return message; }, - - toJSON(message: QueryConnectionClientStateResponse): unknown { - const obj: any = {}; - message.identifiedClientState !== undefined && - (obj.identifiedClientState = message.identifiedClientState - ? IdentifiedClientState.toJSON(message.identifiedClientState) - : undefined); - message.proof !== undefined && - (obj.proof = base64FromBytes(message.proof !== undefined ? message.proof : new Uint8Array())); - message.proofHeight !== undefined && - (obj.proofHeight = message.proofHeight ? Height.toJSON(message.proofHeight) : undefined); - return obj; - }, }; const baseQueryConnectionConsensusStateRequest: object = { @@ -721,18 +729,22 @@ export const QueryConnectionConsensusStateRequest = { message: QueryConnectionConsensusStateRequest, writer: _m0.Writer = _m0.Writer.create(), ): _m0.Writer { - writer.uint32(10).string(message.connectionId); - writer.uint32(16).uint64(message.revisionNumber); - writer.uint32(24).uint64(message.revisionHeight); + if (message.connectionId !== "") { + writer.uint32(10).string(message.connectionId); + } + if (!message.revisionNumber.isZero()) { + writer.uint32(16).uint64(message.revisionNumber); + } + if (!message.revisionHeight.isZero()) { + writer.uint32(24).uint64(message.revisionHeight); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): QueryConnectionConsensusStateRequest { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create( - baseQueryConnectionConsensusStateRequest, - ) as QueryConnectionConsensusStateRequest; + const message = { ...baseQueryConnectionConsensusStateRequest } as QueryConnectionConsensusStateRequest; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -754,9 +766,7 @@ export const QueryConnectionConsensusStateRequest = { }, fromJSON(object: any): QueryConnectionConsensusStateRequest { - const message = Object.create( - baseQueryConnectionConsensusStateRequest, - ) as QueryConnectionConsensusStateRequest; + const message = { ...baseQueryConnectionConsensusStateRequest } as QueryConnectionConsensusStateRequest; if (object.connectionId !== undefined && object.connectionId !== null) { message.connectionId = String(object.connectionId); } else { @@ -775,6 +785,16 @@ export const QueryConnectionConsensusStateRequest = { return message; }, + toJSON(message: QueryConnectionConsensusStateRequest): unknown { + const obj: any = {}; + message.connectionId !== undefined && (obj.connectionId = message.connectionId); + message.revisionNumber !== undefined && + (obj.revisionNumber = (message.revisionNumber || Long.UZERO).toString()); + message.revisionHeight !== undefined && + (obj.revisionHeight = (message.revisionHeight || Long.UZERO).toString()); + return obj; + }, + fromPartial( object: DeepPartial, ): QueryConnectionConsensusStateRequest { @@ -796,16 +816,6 @@ export const QueryConnectionConsensusStateRequest = { } return message; }, - - toJSON(message: QueryConnectionConsensusStateRequest): unknown { - const obj: any = {}; - message.connectionId !== undefined && (obj.connectionId = message.connectionId); - message.revisionNumber !== undefined && - (obj.revisionNumber = (message.revisionNumber || Long.UZERO).toString()); - message.revisionHeight !== undefined && - (obj.revisionHeight = (message.revisionHeight || Long.UZERO).toString()); - return obj; - }, }; const baseQueryConnectionConsensusStateResponse: object = { clientId: "" }; @@ -818,8 +828,12 @@ export const QueryConnectionConsensusStateResponse = { if (message.consensusState !== undefined) { Any.encode(message.consensusState, writer.uint32(10).fork()).ldelim(); } - writer.uint32(18).string(message.clientId); - writer.uint32(26).bytes(message.proof); + if (message.clientId !== "") { + writer.uint32(18).string(message.clientId); + } + if (message.proof.length !== 0) { + writer.uint32(26).bytes(message.proof); + } if (message.proofHeight !== undefined) { Height.encode(message.proofHeight, writer.uint32(34).fork()).ldelim(); } @@ -829,9 +843,7 @@ export const QueryConnectionConsensusStateResponse = { decode(input: _m0.Reader | Uint8Array, length?: number): QueryConnectionConsensusStateResponse { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create( - baseQueryConnectionConsensusStateResponse, - ) as QueryConnectionConsensusStateResponse; + const message = { ...baseQueryConnectionConsensusStateResponse } as QueryConnectionConsensusStateResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -856,9 +868,7 @@ export const QueryConnectionConsensusStateResponse = { }, fromJSON(object: any): QueryConnectionConsensusStateResponse { - const message = Object.create( - baseQueryConnectionConsensusStateResponse, - ) as QueryConnectionConsensusStateResponse; + const message = { ...baseQueryConnectionConsensusStateResponse } as QueryConnectionConsensusStateResponse; if (object.consensusState !== undefined && object.consensusState !== null) { message.consensusState = Any.fromJSON(object.consensusState); } else { @@ -880,6 +890,18 @@ export const QueryConnectionConsensusStateResponse = { return message; }, + toJSON(message: QueryConnectionConsensusStateResponse): unknown { + const obj: any = {}; + message.consensusState !== undefined && + (obj.consensusState = message.consensusState ? Any.toJSON(message.consensusState) : undefined); + message.clientId !== undefined && (obj.clientId = message.clientId); + message.proof !== undefined && + (obj.proof = base64FromBytes(message.proof !== undefined ? message.proof : new Uint8Array())); + message.proofHeight !== undefined && + (obj.proofHeight = message.proofHeight ? Height.toJSON(message.proofHeight) : undefined); + return obj; + }, + fromPartial( object: DeepPartial, ): QueryConnectionConsensusStateResponse { @@ -906,18 +928,6 @@ export const QueryConnectionConsensusStateResponse = { } return message; }, - - toJSON(message: QueryConnectionConsensusStateResponse): unknown { - const obj: any = {}; - message.consensusState !== undefined && - (obj.consensusState = message.consensusState ? Any.toJSON(message.consensusState) : undefined); - message.clientId !== undefined && (obj.clientId = message.clientId); - message.proof !== undefined && - (obj.proof = base64FromBytes(message.proof !== undefined ? message.proof : new Uint8Array())); - message.proofHeight !== undefined && - (obj.proofHeight = message.proofHeight ? Height.toJSON(message.proofHeight) : undefined); - return obj; - }, }; /** Query provides defines the gRPC querier service */ @@ -998,7 +1008,7 @@ var globalThis: any = (() => { if (typeof self !== "undefined") return self; if (typeof window !== "undefined") return window; if (typeof global !== "undefined") return global; - throw new Error("Unable to locate global object"); + throw "Unable to locate global object"; })(); const atob: (b64: string) => string = diff --git a/packages/stargate/src/codec/tendermint/abci/types.ts b/packages/stargate/src/codec/tendermint/abci/types.ts index c1d5527a..374cb3c9 100644 --- a/packages/stargate/src/codec/tendermint/abci/types.ts +++ b/packages/stargate/src/codec/tendermint/abci/types.ts @@ -588,7 +588,7 @@ export const Request = { decode(input: _m0.Reader | Uint8Array, length?: number): Request { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseRequest) as Request; + const message = { ...baseRequest } as Request; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -646,7 +646,7 @@ export const Request = { }, fromJSON(object: any): Request { - const message = Object.create(baseRequest) as Request; + const message = { ...baseRequest } as Request; if (object.echo !== undefined && object.echo !== null) { message.echo = RequestEcho.fromJSON(object.echo); } else { @@ -725,6 +725,47 @@ export const Request = { return message; }, + toJSON(message: Request): unknown { + const obj: any = {}; + message.echo !== undefined && (obj.echo = message.echo ? RequestEcho.toJSON(message.echo) : undefined); + message.flush !== undefined && + (obj.flush = message.flush ? RequestFlush.toJSON(message.flush) : undefined); + message.info !== undefined && (obj.info = message.info ? RequestInfo.toJSON(message.info) : undefined); + message.setOption !== undefined && + (obj.setOption = message.setOption ? RequestSetOption.toJSON(message.setOption) : undefined); + message.initChain !== undefined && + (obj.initChain = message.initChain ? RequestInitChain.toJSON(message.initChain) : undefined); + message.query !== undefined && + (obj.query = message.query ? RequestQuery.toJSON(message.query) : undefined); + message.beginBlock !== undefined && + (obj.beginBlock = message.beginBlock ? RequestBeginBlock.toJSON(message.beginBlock) : undefined); + message.checkTx !== undefined && + (obj.checkTx = message.checkTx ? RequestCheckTx.toJSON(message.checkTx) : undefined); + message.deliverTx !== undefined && + (obj.deliverTx = message.deliverTx ? RequestDeliverTx.toJSON(message.deliverTx) : undefined); + message.endBlock !== undefined && + (obj.endBlock = message.endBlock ? RequestEndBlock.toJSON(message.endBlock) : undefined); + message.commit !== undefined && + (obj.commit = message.commit ? RequestCommit.toJSON(message.commit) : undefined); + message.listSnapshots !== undefined && + (obj.listSnapshots = message.listSnapshots + ? RequestListSnapshots.toJSON(message.listSnapshots) + : undefined); + message.offerSnapshot !== undefined && + (obj.offerSnapshot = message.offerSnapshot + ? RequestOfferSnapshot.toJSON(message.offerSnapshot) + : undefined); + message.loadSnapshotChunk !== undefined && + (obj.loadSnapshotChunk = message.loadSnapshotChunk + ? RequestLoadSnapshotChunk.toJSON(message.loadSnapshotChunk) + : undefined); + message.applySnapshotChunk !== undefined && + (obj.applySnapshotChunk = message.applySnapshotChunk + ? RequestApplySnapshotChunk.toJSON(message.applySnapshotChunk) + : undefined); + return obj; + }, + fromPartial(object: DeepPartial): Request { const message = { ...baseRequest } as Request; if (object.echo !== undefined && object.echo !== null) { @@ -804,61 +845,22 @@ export const Request = { } return message; }, - - toJSON(message: Request): unknown { - const obj: any = {}; - message.echo !== undefined && (obj.echo = message.echo ? RequestEcho.toJSON(message.echo) : undefined); - message.flush !== undefined && - (obj.flush = message.flush ? RequestFlush.toJSON(message.flush) : undefined); - message.info !== undefined && (obj.info = message.info ? RequestInfo.toJSON(message.info) : undefined); - message.setOption !== undefined && - (obj.setOption = message.setOption ? RequestSetOption.toJSON(message.setOption) : undefined); - message.initChain !== undefined && - (obj.initChain = message.initChain ? RequestInitChain.toJSON(message.initChain) : undefined); - message.query !== undefined && - (obj.query = message.query ? RequestQuery.toJSON(message.query) : undefined); - message.beginBlock !== undefined && - (obj.beginBlock = message.beginBlock ? RequestBeginBlock.toJSON(message.beginBlock) : undefined); - message.checkTx !== undefined && - (obj.checkTx = message.checkTx ? RequestCheckTx.toJSON(message.checkTx) : undefined); - message.deliverTx !== undefined && - (obj.deliverTx = message.deliverTx ? RequestDeliverTx.toJSON(message.deliverTx) : undefined); - message.endBlock !== undefined && - (obj.endBlock = message.endBlock ? RequestEndBlock.toJSON(message.endBlock) : undefined); - message.commit !== undefined && - (obj.commit = message.commit ? RequestCommit.toJSON(message.commit) : undefined); - message.listSnapshots !== undefined && - (obj.listSnapshots = message.listSnapshots - ? RequestListSnapshots.toJSON(message.listSnapshots) - : undefined); - message.offerSnapshot !== undefined && - (obj.offerSnapshot = message.offerSnapshot - ? RequestOfferSnapshot.toJSON(message.offerSnapshot) - : undefined); - message.loadSnapshotChunk !== undefined && - (obj.loadSnapshotChunk = message.loadSnapshotChunk - ? RequestLoadSnapshotChunk.toJSON(message.loadSnapshotChunk) - : undefined); - message.applySnapshotChunk !== undefined && - (obj.applySnapshotChunk = message.applySnapshotChunk - ? RequestApplySnapshotChunk.toJSON(message.applySnapshotChunk) - : undefined); - return obj; - }, }; const baseRequestEcho: object = { message: "" }; export const RequestEcho = { encode(message: RequestEcho, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.message); + if (message.message !== "") { + writer.uint32(10).string(message.message); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): RequestEcho { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseRequestEcho) as RequestEcho; + const message = { ...baseRequestEcho } as RequestEcho; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -874,19 +876,9 @@ export const RequestEcho = { }, fromJSON(object: any): RequestEcho { - const message = Object.create(baseRequestEcho) as RequestEcho; - if (object.message !== undefined && object.message !== null) { - message.message = String(object.message); - } else { - message.message = ""; - } - return message; - }, - - fromPartial(object: DeepPartial): RequestEcho { const message = { ...baseRequestEcho } as RequestEcho; if (object.message !== undefined && object.message !== null) { - message.message = object.message; + message.message = String(object.message); } else { message.message = ""; } @@ -898,6 +890,16 @@ export const RequestEcho = { message.message !== undefined && (obj.message = message.message); return obj; }, + + fromPartial(object: DeepPartial): RequestEcho { + const message = { ...baseRequestEcho } as RequestEcho; + if (object.message !== undefined && object.message !== null) { + message.message = object.message; + } else { + message.message = ""; + } + return message; + }, }; const baseRequestFlush: object = {}; @@ -910,7 +912,7 @@ export const RequestFlush = { decode(input: _m0.Reader | Uint8Array, length?: number): RequestFlush { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseRequestFlush) as RequestFlush; + const message = { ...baseRequestFlush } as RequestFlush; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -923,11 +925,6 @@ export const RequestFlush = { }, fromJSON(_: any): RequestFlush { - const message = Object.create(baseRequestFlush) as RequestFlush; - return message; - }, - - fromPartial(_: DeepPartial): RequestFlush { const message = { ...baseRequestFlush } as RequestFlush; return message; }, @@ -936,22 +933,33 @@ export const RequestFlush = { const obj: any = {}; return obj; }, + + fromPartial(_: DeepPartial): RequestFlush { + const message = { ...baseRequestFlush } as RequestFlush; + return message; + }, }; const baseRequestInfo: object = { version: "", blockVersion: Long.UZERO, p2pVersion: Long.UZERO }; export const RequestInfo = { encode(message: RequestInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.version); - writer.uint32(16).uint64(message.blockVersion); - writer.uint32(24).uint64(message.p2pVersion); + if (message.version !== "") { + writer.uint32(10).string(message.version); + } + if (!message.blockVersion.isZero()) { + writer.uint32(16).uint64(message.blockVersion); + } + if (!message.p2pVersion.isZero()) { + writer.uint32(24).uint64(message.p2pVersion); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): RequestInfo { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseRequestInfo) as RequestInfo; + const message = { ...baseRequestInfo } as RequestInfo; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -973,7 +981,7 @@ export const RequestInfo = { }, fromJSON(object: any): RequestInfo { - const message = Object.create(baseRequestInfo) as RequestInfo; + const message = { ...baseRequestInfo } as RequestInfo; if (object.version !== undefined && object.version !== null) { message.version = String(object.version); } else { @@ -992,6 +1000,15 @@ export const RequestInfo = { return message; }, + toJSON(message: RequestInfo): unknown { + const obj: any = {}; + message.version !== undefined && (obj.version = message.version); + message.blockVersion !== undefined && + (obj.blockVersion = (message.blockVersion || Long.UZERO).toString()); + message.p2pVersion !== undefined && (obj.p2pVersion = (message.p2pVersion || Long.UZERO).toString()); + return obj; + }, + fromPartial(object: DeepPartial): RequestInfo { const message = { ...baseRequestInfo } as RequestInfo; if (object.version !== undefined && object.version !== null) { @@ -1011,30 +1028,25 @@ export const RequestInfo = { } return message; }, - - toJSON(message: RequestInfo): unknown { - const obj: any = {}; - message.version !== undefined && (obj.version = message.version); - message.blockVersion !== undefined && - (obj.blockVersion = (message.blockVersion || Long.UZERO).toString()); - message.p2pVersion !== undefined && (obj.p2pVersion = (message.p2pVersion || Long.UZERO).toString()); - return obj; - }, }; const baseRequestSetOption: object = { key: "", value: "" }; export const RequestSetOption = { encode(message: RequestSetOption, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.key); - writer.uint32(18).string(message.value); + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): RequestSetOption { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseRequestSetOption) as RequestSetOption; + const message = { ...baseRequestSetOption } as RequestSetOption; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1053,7 +1065,7 @@ export const RequestSetOption = { }, fromJSON(object: any): RequestSetOption { - const message = Object.create(baseRequestSetOption) as RequestSetOption; + const message = { ...baseRequestSetOption } as RequestSetOption; if (object.key !== undefined && object.key !== null) { message.key = String(object.key); } else { @@ -1067,6 +1079,13 @@ export const RequestSetOption = { return message; }, + toJSON(message: RequestSetOption): unknown { + const obj: any = {}; + message.key !== undefined && (obj.key = message.key); + message.value !== undefined && (obj.value = message.value); + return obj; + }, + fromPartial(object: DeepPartial): RequestSetOption { const message = { ...baseRequestSetOption } as RequestSetOption; if (object.key !== undefined && object.key !== null) { @@ -1081,13 +1100,6 @@ export const RequestSetOption = { } return message; }, - - toJSON(message: RequestSetOption): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = message.key); - message.value !== undefined && (obj.value = message.value); - return obj; - }, }; const baseRequestInitChain: object = { chainId: "", initialHeight: Long.ZERO }; @@ -1097,22 +1109,28 @@ export const RequestInitChain = { if (message.time !== undefined) { Timestamp.encode(toTimestamp(message.time), writer.uint32(10).fork()).ldelim(); } - writer.uint32(18).string(message.chainId); + if (message.chainId !== "") { + writer.uint32(18).string(message.chainId); + } if (message.consensusParams !== undefined) { ConsensusParams.encode(message.consensusParams, writer.uint32(26).fork()).ldelim(); } for (const v of message.validators) { ValidatorUpdate.encode(v!, writer.uint32(34).fork()).ldelim(); } - writer.uint32(42).bytes(message.appStateBytes); - writer.uint32(48).int64(message.initialHeight); + if (message.appStateBytes.length !== 0) { + writer.uint32(42).bytes(message.appStateBytes); + } + if (!message.initialHeight.isZero()) { + writer.uint32(48).int64(message.initialHeight); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): RequestInitChain { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseRequestInitChain) as RequestInitChain; + const message = { ...baseRequestInitChain } as RequestInitChain; message.validators = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -1144,7 +1162,7 @@ export const RequestInitChain = { }, fromJSON(object: any): RequestInitChain { - const message = Object.create(baseRequestInitChain) as RequestInitChain; + const message = { ...baseRequestInitChain } as RequestInitChain; message.validators = []; if (object.time !== undefined && object.time !== null) { message.time = fromJsonTimestamp(object.time); @@ -1177,6 +1195,28 @@ export const RequestInitChain = { return message; }, + toJSON(message: RequestInitChain): unknown { + const obj: any = {}; + message.time !== undefined && (obj.time = message.time !== undefined ? message.time.toISOString() : null); + message.chainId !== undefined && (obj.chainId = message.chainId); + message.consensusParams !== undefined && + (obj.consensusParams = message.consensusParams + ? ConsensusParams.toJSON(message.consensusParams) + : undefined); + if (message.validators) { + obj.validators = message.validators.map((e) => (e ? ValidatorUpdate.toJSON(e) : undefined)); + } else { + obj.validators = []; + } + message.appStateBytes !== undefined && + (obj.appStateBytes = base64FromBytes( + message.appStateBytes !== undefined ? message.appStateBytes : new Uint8Array(), + )); + message.initialHeight !== undefined && + (obj.initialHeight = (message.initialHeight || Long.ZERO).toString()); + return obj; + }, + fromPartial(object: DeepPartial): RequestInitChain { const message = { ...baseRequestInitChain } as RequestInitChain; message.validators = []; @@ -1212,45 +1252,31 @@ export const RequestInitChain = { } return message; }, - - toJSON(message: RequestInitChain): unknown { - const obj: any = {}; - message.time !== undefined && (obj.time = message.time !== undefined ? message.time.toISOString() : null); - message.chainId !== undefined && (obj.chainId = message.chainId); - message.consensusParams !== undefined && - (obj.consensusParams = message.consensusParams - ? ConsensusParams.toJSON(message.consensusParams) - : undefined); - if (message.validators) { - obj.validators = message.validators.map((e) => (e ? ValidatorUpdate.toJSON(e) : undefined)); - } else { - obj.validators = []; - } - message.appStateBytes !== undefined && - (obj.appStateBytes = base64FromBytes( - message.appStateBytes !== undefined ? message.appStateBytes : new Uint8Array(), - )); - message.initialHeight !== undefined && - (obj.initialHeight = (message.initialHeight || Long.ZERO).toString()); - return obj; - }, }; const baseRequestQuery: object = { path: "", height: Long.ZERO, prove: false }; export const RequestQuery = { encode(message: RequestQuery, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).bytes(message.data); - writer.uint32(18).string(message.path); - writer.uint32(24).int64(message.height); - writer.uint32(32).bool(message.prove); + if (message.data.length !== 0) { + writer.uint32(10).bytes(message.data); + } + if (message.path !== "") { + writer.uint32(18).string(message.path); + } + if (!message.height.isZero()) { + writer.uint32(24).int64(message.height); + } + if (message.prove === true) { + writer.uint32(32).bool(message.prove); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): RequestQuery { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseRequestQuery) as RequestQuery; + const message = { ...baseRequestQuery } as RequestQuery; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1275,7 +1301,7 @@ export const RequestQuery = { }, fromJSON(object: any): RequestQuery { - const message = Object.create(baseRequestQuery) as RequestQuery; + const message = { ...baseRequestQuery } as RequestQuery; if (object.data !== undefined && object.data !== null) { message.data = bytesFromBase64(object.data); } @@ -1297,6 +1323,16 @@ export const RequestQuery = { return message; }, + toJSON(message: RequestQuery): unknown { + const obj: any = {}; + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); + message.path !== undefined && (obj.path = message.path); + message.height !== undefined && (obj.height = (message.height || Long.ZERO).toString()); + message.prove !== undefined && (obj.prove = message.prove); + return obj; + }, + fromPartial(object: DeepPartial): RequestQuery { const message = { ...baseRequestQuery } as RequestQuery; if (object.data !== undefined && object.data !== null) { @@ -1321,23 +1357,15 @@ export const RequestQuery = { } return message; }, - - toJSON(message: RequestQuery): unknown { - const obj: any = {}; - message.data !== undefined && - (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); - message.path !== undefined && (obj.path = message.path); - message.height !== undefined && (obj.height = (message.height || Long.ZERO).toString()); - message.prove !== undefined && (obj.prove = message.prove); - return obj; - }, }; const baseRequestBeginBlock: object = {}; export const RequestBeginBlock = { encode(message: RequestBeginBlock, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).bytes(message.hash); + if (message.hash.length !== 0) { + writer.uint32(10).bytes(message.hash); + } if (message.header !== undefined) { Header.encode(message.header, writer.uint32(18).fork()).ldelim(); } @@ -1353,7 +1381,7 @@ export const RequestBeginBlock = { decode(input: _m0.Reader | Uint8Array, length?: number): RequestBeginBlock { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseRequestBeginBlock) as RequestBeginBlock; + const message = { ...baseRequestBeginBlock } as RequestBeginBlock; message.byzantineValidators = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -1379,7 +1407,7 @@ export const RequestBeginBlock = { }, fromJSON(object: any): RequestBeginBlock { - const message = Object.create(baseRequestBeginBlock) as RequestBeginBlock; + const message = { ...baseRequestBeginBlock } as RequestBeginBlock; message.byzantineValidators = []; if (object.hash !== undefined && object.hash !== null) { message.hash = bytesFromBase64(object.hash); @@ -1402,6 +1430,23 @@ export const RequestBeginBlock = { return message; }, + toJSON(message: RequestBeginBlock): unknown { + const obj: any = {}; + message.hash !== undefined && + (obj.hash = base64FromBytes(message.hash !== undefined ? message.hash : new Uint8Array())); + message.header !== undefined && (obj.header = message.header ? Header.toJSON(message.header) : undefined); + message.lastCommitInfo !== undefined && + (obj.lastCommitInfo = message.lastCommitInfo + ? LastCommitInfo.toJSON(message.lastCommitInfo) + : undefined); + if (message.byzantineValidators) { + obj.byzantineValidators = message.byzantineValidators.map((e) => (e ? Evidence.toJSON(e) : undefined)); + } else { + obj.byzantineValidators = []; + } + return obj; + }, + fromPartial(object: DeepPartial): RequestBeginBlock { const message = { ...baseRequestBeginBlock } as RequestBeginBlock; message.byzantineValidators = []; @@ -1427,38 +1472,25 @@ export const RequestBeginBlock = { } return message; }, - - toJSON(message: RequestBeginBlock): unknown { - const obj: any = {}; - message.hash !== undefined && - (obj.hash = base64FromBytes(message.hash !== undefined ? message.hash : new Uint8Array())); - message.header !== undefined && (obj.header = message.header ? Header.toJSON(message.header) : undefined); - message.lastCommitInfo !== undefined && - (obj.lastCommitInfo = message.lastCommitInfo - ? LastCommitInfo.toJSON(message.lastCommitInfo) - : undefined); - if (message.byzantineValidators) { - obj.byzantineValidators = message.byzantineValidators.map((e) => (e ? Evidence.toJSON(e) : undefined)); - } else { - obj.byzantineValidators = []; - } - return obj; - }, }; const baseRequestCheckTx: object = { type: 0 }; export const RequestCheckTx = { encode(message: RequestCheckTx, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).bytes(message.tx); - writer.uint32(16).int32(message.type); + if (message.tx.length !== 0) { + writer.uint32(10).bytes(message.tx); + } + if (message.type !== 0) { + writer.uint32(16).int32(message.type); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): RequestCheckTx { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseRequestCheckTx) as RequestCheckTx; + const message = { ...baseRequestCheckTx } as RequestCheckTx; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1477,7 +1509,7 @@ export const RequestCheckTx = { }, fromJSON(object: any): RequestCheckTx { - const message = Object.create(baseRequestCheckTx) as RequestCheckTx; + const message = { ...baseRequestCheckTx } as RequestCheckTx; if (object.tx !== undefined && object.tx !== null) { message.tx = bytesFromBase64(object.tx); } @@ -1489,6 +1521,14 @@ export const RequestCheckTx = { return message; }, + toJSON(message: RequestCheckTx): unknown { + const obj: any = {}; + message.tx !== undefined && + (obj.tx = base64FromBytes(message.tx !== undefined ? message.tx : new Uint8Array())); + message.type !== undefined && (obj.type = checkTxTypeToJSON(message.type)); + return obj; + }, + fromPartial(object: DeepPartial): RequestCheckTx { const message = { ...baseRequestCheckTx } as RequestCheckTx; if (object.tx !== undefined && object.tx !== null) { @@ -1503,28 +1543,22 @@ export const RequestCheckTx = { } return message; }, - - toJSON(message: RequestCheckTx): unknown { - const obj: any = {}; - message.tx !== undefined && - (obj.tx = base64FromBytes(message.tx !== undefined ? message.tx : new Uint8Array())); - message.type !== undefined && (obj.type = checkTxTypeToJSON(message.type)); - return obj; - }, }; const baseRequestDeliverTx: object = {}; export const RequestDeliverTx = { encode(message: RequestDeliverTx, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).bytes(message.tx); + if (message.tx.length !== 0) { + writer.uint32(10).bytes(message.tx); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): RequestDeliverTx { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseRequestDeliverTx) as RequestDeliverTx; + const message = { ...baseRequestDeliverTx } as RequestDeliverTx; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1540,13 +1574,20 @@ export const RequestDeliverTx = { }, fromJSON(object: any): RequestDeliverTx { - const message = Object.create(baseRequestDeliverTx) as RequestDeliverTx; + const message = { ...baseRequestDeliverTx } as RequestDeliverTx; if (object.tx !== undefined && object.tx !== null) { message.tx = bytesFromBase64(object.tx); } return message; }, + toJSON(message: RequestDeliverTx): unknown { + const obj: any = {}; + message.tx !== undefined && + (obj.tx = base64FromBytes(message.tx !== undefined ? message.tx : new Uint8Array())); + return obj; + }, + fromPartial(object: DeepPartial): RequestDeliverTx { const message = { ...baseRequestDeliverTx } as RequestDeliverTx; if (object.tx !== undefined && object.tx !== null) { @@ -1556,27 +1597,22 @@ export const RequestDeliverTx = { } return message; }, - - toJSON(message: RequestDeliverTx): unknown { - const obj: any = {}; - message.tx !== undefined && - (obj.tx = base64FromBytes(message.tx !== undefined ? message.tx : new Uint8Array())); - return obj; - }, }; const baseRequestEndBlock: object = { height: Long.ZERO }; export const RequestEndBlock = { encode(message: RequestEndBlock, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).int64(message.height); + if (!message.height.isZero()) { + writer.uint32(8).int64(message.height); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): RequestEndBlock { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseRequestEndBlock) as RequestEndBlock; + const message = { ...baseRequestEndBlock } as RequestEndBlock; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1592,19 +1628,9 @@ export const RequestEndBlock = { }, fromJSON(object: any): RequestEndBlock { - const message = Object.create(baseRequestEndBlock) as RequestEndBlock; - if (object.height !== undefined && object.height !== null) { - message.height = Long.fromString(object.height); - } else { - message.height = Long.ZERO; - } - return message; - }, - - fromPartial(object: DeepPartial): RequestEndBlock { const message = { ...baseRequestEndBlock } as RequestEndBlock; if (object.height !== undefined && object.height !== null) { - message.height = object.height as Long; + message.height = Long.fromString(object.height); } else { message.height = Long.ZERO; } @@ -1616,6 +1642,16 @@ export const RequestEndBlock = { message.height !== undefined && (obj.height = (message.height || Long.ZERO).toString()); return obj; }, + + fromPartial(object: DeepPartial): RequestEndBlock { + const message = { ...baseRequestEndBlock } as RequestEndBlock; + if (object.height !== undefined && object.height !== null) { + message.height = object.height as Long; + } else { + message.height = Long.ZERO; + } + return message; + }, }; const baseRequestCommit: object = {}; @@ -1628,7 +1664,7 @@ export const RequestCommit = { decode(input: _m0.Reader | Uint8Array, length?: number): RequestCommit { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseRequestCommit) as RequestCommit; + const message = { ...baseRequestCommit } as RequestCommit; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1641,11 +1677,6 @@ export const RequestCommit = { }, fromJSON(_: any): RequestCommit { - const message = Object.create(baseRequestCommit) as RequestCommit; - return message; - }, - - fromPartial(_: DeepPartial): RequestCommit { const message = { ...baseRequestCommit } as RequestCommit; return message; }, @@ -1654,6 +1685,11 @@ export const RequestCommit = { const obj: any = {}; return obj; }, + + fromPartial(_: DeepPartial): RequestCommit { + const message = { ...baseRequestCommit } as RequestCommit; + return message; + }, }; const baseRequestListSnapshots: object = {}; @@ -1666,7 +1702,7 @@ export const RequestListSnapshots = { decode(input: _m0.Reader | Uint8Array, length?: number): RequestListSnapshots { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseRequestListSnapshots) as RequestListSnapshots; + const message = { ...baseRequestListSnapshots } as RequestListSnapshots; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1679,11 +1715,6 @@ export const RequestListSnapshots = { }, fromJSON(_: any): RequestListSnapshots { - const message = Object.create(baseRequestListSnapshots) as RequestListSnapshots; - return message; - }, - - fromPartial(_: DeepPartial): RequestListSnapshots { const message = { ...baseRequestListSnapshots } as RequestListSnapshots; return message; }, @@ -1692,6 +1723,11 @@ export const RequestListSnapshots = { const obj: any = {}; return obj; }, + + fromPartial(_: DeepPartial): RequestListSnapshots { + const message = { ...baseRequestListSnapshots } as RequestListSnapshots; + return message; + }, }; const baseRequestOfferSnapshot: object = {}; @@ -1701,14 +1737,16 @@ export const RequestOfferSnapshot = { if (message.snapshot !== undefined) { Snapshot.encode(message.snapshot, writer.uint32(10).fork()).ldelim(); } - writer.uint32(18).bytes(message.appHash); + if (message.appHash.length !== 0) { + writer.uint32(18).bytes(message.appHash); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): RequestOfferSnapshot { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseRequestOfferSnapshot) as RequestOfferSnapshot; + const message = { ...baseRequestOfferSnapshot } as RequestOfferSnapshot; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1727,7 +1765,7 @@ export const RequestOfferSnapshot = { }, fromJSON(object: any): RequestOfferSnapshot { - const message = Object.create(baseRequestOfferSnapshot) as RequestOfferSnapshot; + const message = { ...baseRequestOfferSnapshot } as RequestOfferSnapshot; if (object.snapshot !== undefined && object.snapshot !== null) { message.snapshot = Snapshot.fromJSON(object.snapshot); } else { @@ -1739,6 +1777,15 @@ export const RequestOfferSnapshot = { return message; }, + toJSON(message: RequestOfferSnapshot): unknown { + const obj: any = {}; + message.snapshot !== undefined && + (obj.snapshot = message.snapshot ? Snapshot.toJSON(message.snapshot) : undefined); + message.appHash !== undefined && + (obj.appHash = base64FromBytes(message.appHash !== undefined ? message.appHash : new Uint8Array())); + return obj; + }, + fromPartial(object: DeepPartial): RequestOfferSnapshot { const message = { ...baseRequestOfferSnapshot } as RequestOfferSnapshot; if (object.snapshot !== undefined && object.snapshot !== null) { @@ -1753,31 +1800,28 @@ export const RequestOfferSnapshot = { } return message; }, - - toJSON(message: RequestOfferSnapshot): unknown { - const obj: any = {}; - message.snapshot !== undefined && - (obj.snapshot = message.snapshot ? Snapshot.toJSON(message.snapshot) : undefined); - message.appHash !== undefined && - (obj.appHash = base64FromBytes(message.appHash !== undefined ? message.appHash : new Uint8Array())); - return obj; - }, }; const baseRequestLoadSnapshotChunk: object = { height: Long.UZERO, format: 0, chunk: 0 }; export const RequestLoadSnapshotChunk = { encode(message: RequestLoadSnapshotChunk, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).uint64(message.height); - writer.uint32(16).uint32(message.format); - writer.uint32(24).uint32(message.chunk); + if (!message.height.isZero()) { + writer.uint32(8).uint64(message.height); + } + if (message.format !== 0) { + writer.uint32(16).uint32(message.format); + } + if (message.chunk !== 0) { + writer.uint32(24).uint32(message.chunk); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): RequestLoadSnapshotChunk { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseRequestLoadSnapshotChunk) as RequestLoadSnapshotChunk; + const message = { ...baseRequestLoadSnapshotChunk } as RequestLoadSnapshotChunk; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1799,7 +1843,7 @@ export const RequestLoadSnapshotChunk = { }, fromJSON(object: any): RequestLoadSnapshotChunk { - const message = Object.create(baseRequestLoadSnapshotChunk) as RequestLoadSnapshotChunk; + const message = { ...baseRequestLoadSnapshotChunk } as RequestLoadSnapshotChunk; if (object.height !== undefined && object.height !== null) { message.height = Long.fromString(object.height); } else { @@ -1818,6 +1862,14 @@ export const RequestLoadSnapshotChunk = { return message; }, + toJSON(message: RequestLoadSnapshotChunk): unknown { + const obj: any = {}; + message.height !== undefined && (obj.height = (message.height || Long.UZERO).toString()); + message.format !== undefined && (obj.format = message.format); + message.chunk !== undefined && (obj.chunk = message.chunk); + return obj; + }, + fromPartial(object: DeepPartial): RequestLoadSnapshotChunk { const message = { ...baseRequestLoadSnapshotChunk } as RequestLoadSnapshotChunk; if (object.height !== undefined && object.height !== null) { @@ -1837,30 +1889,28 @@ export const RequestLoadSnapshotChunk = { } return message; }, - - toJSON(message: RequestLoadSnapshotChunk): unknown { - const obj: any = {}; - message.height !== undefined && (obj.height = (message.height || Long.UZERO).toString()); - message.format !== undefined && (obj.format = message.format); - message.chunk !== undefined && (obj.chunk = message.chunk); - return obj; - }, }; const baseRequestApplySnapshotChunk: object = { index: 0, sender: "" }; export const RequestApplySnapshotChunk = { encode(message: RequestApplySnapshotChunk, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).uint32(message.index); - writer.uint32(18).bytes(message.chunk); - writer.uint32(26).string(message.sender); + if (message.index !== 0) { + writer.uint32(8).uint32(message.index); + } + if (message.chunk.length !== 0) { + writer.uint32(18).bytes(message.chunk); + } + if (message.sender !== "") { + writer.uint32(26).string(message.sender); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): RequestApplySnapshotChunk { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseRequestApplySnapshotChunk) as RequestApplySnapshotChunk; + const message = { ...baseRequestApplySnapshotChunk } as RequestApplySnapshotChunk; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1882,7 +1932,7 @@ export const RequestApplySnapshotChunk = { }, fromJSON(object: any): RequestApplySnapshotChunk { - const message = Object.create(baseRequestApplySnapshotChunk) as RequestApplySnapshotChunk; + const message = { ...baseRequestApplySnapshotChunk } as RequestApplySnapshotChunk; if (object.index !== undefined && object.index !== null) { message.index = Number(object.index); } else { @@ -1899,6 +1949,15 @@ export const RequestApplySnapshotChunk = { return message; }, + toJSON(message: RequestApplySnapshotChunk): unknown { + const obj: any = {}; + message.index !== undefined && (obj.index = message.index); + message.chunk !== undefined && + (obj.chunk = base64FromBytes(message.chunk !== undefined ? message.chunk : new Uint8Array())); + message.sender !== undefined && (obj.sender = message.sender); + return obj; + }, + fromPartial(object: DeepPartial): RequestApplySnapshotChunk { const message = { ...baseRequestApplySnapshotChunk } as RequestApplySnapshotChunk; if (object.index !== undefined && object.index !== null) { @@ -1918,15 +1977,6 @@ export const RequestApplySnapshotChunk = { } return message; }, - - toJSON(message: RequestApplySnapshotChunk): unknown { - const obj: any = {}; - message.index !== undefined && (obj.index = message.index); - message.chunk !== undefined && - (obj.chunk = base64FromBytes(message.chunk !== undefined ? message.chunk : new Uint8Array())); - message.sender !== undefined && (obj.sender = message.sender); - return obj; - }, }; const baseResponse: object = {}; @@ -1987,7 +2037,7 @@ export const Response = { decode(input: _m0.Reader | Uint8Array, length?: number): Response { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseResponse) as Response; + const message = { ...baseResponse } as Response; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -2048,7 +2098,7 @@ export const Response = { }, fromJSON(object: any): Response { - const message = Object.create(baseResponse) as Response; + const message = { ...baseResponse } as Response; if (object.exception !== undefined && object.exception !== null) { message.exception = ResponseException.fromJSON(object.exception); } else { @@ -2132,6 +2182,49 @@ export const Response = { return message; }, + toJSON(message: Response): unknown { + const obj: any = {}; + message.exception !== undefined && + (obj.exception = message.exception ? ResponseException.toJSON(message.exception) : undefined); + message.echo !== undefined && (obj.echo = message.echo ? ResponseEcho.toJSON(message.echo) : undefined); + message.flush !== undefined && + (obj.flush = message.flush ? ResponseFlush.toJSON(message.flush) : undefined); + message.info !== undefined && (obj.info = message.info ? ResponseInfo.toJSON(message.info) : undefined); + message.setOption !== undefined && + (obj.setOption = message.setOption ? ResponseSetOption.toJSON(message.setOption) : undefined); + message.initChain !== undefined && + (obj.initChain = message.initChain ? ResponseInitChain.toJSON(message.initChain) : undefined); + message.query !== undefined && + (obj.query = message.query ? ResponseQuery.toJSON(message.query) : undefined); + message.beginBlock !== undefined && + (obj.beginBlock = message.beginBlock ? ResponseBeginBlock.toJSON(message.beginBlock) : undefined); + message.checkTx !== undefined && + (obj.checkTx = message.checkTx ? ResponseCheckTx.toJSON(message.checkTx) : undefined); + message.deliverTx !== undefined && + (obj.deliverTx = message.deliverTx ? ResponseDeliverTx.toJSON(message.deliverTx) : undefined); + message.endBlock !== undefined && + (obj.endBlock = message.endBlock ? ResponseEndBlock.toJSON(message.endBlock) : undefined); + message.commit !== undefined && + (obj.commit = message.commit ? ResponseCommit.toJSON(message.commit) : undefined); + message.listSnapshots !== undefined && + (obj.listSnapshots = message.listSnapshots + ? ResponseListSnapshots.toJSON(message.listSnapshots) + : undefined); + message.offerSnapshot !== undefined && + (obj.offerSnapshot = message.offerSnapshot + ? ResponseOfferSnapshot.toJSON(message.offerSnapshot) + : undefined); + message.loadSnapshotChunk !== undefined && + (obj.loadSnapshotChunk = message.loadSnapshotChunk + ? ResponseLoadSnapshotChunk.toJSON(message.loadSnapshotChunk) + : undefined); + message.applySnapshotChunk !== undefined && + (obj.applySnapshotChunk = message.applySnapshotChunk + ? ResponseApplySnapshotChunk.toJSON(message.applySnapshotChunk) + : undefined); + return obj; + }, + fromPartial(object: DeepPartial): Response { const message = { ...baseResponse } as Response; if (object.exception !== undefined && object.exception !== null) { @@ -2216,63 +2309,22 @@ export const Response = { } return message; }, - - toJSON(message: Response): unknown { - const obj: any = {}; - message.exception !== undefined && - (obj.exception = message.exception ? ResponseException.toJSON(message.exception) : undefined); - message.echo !== undefined && (obj.echo = message.echo ? ResponseEcho.toJSON(message.echo) : undefined); - message.flush !== undefined && - (obj.flush = message.flush ? ResponseFlush.toJSON(message.flush) : undefined); - message.info !== undefined && (obj.info = message.info ? ResponseInfo.toJSON(message.info) : undefined); - message.setOption !== undefined && - (obj.setOption = message.setOption ? ResponseSetOption.toJSON(message.setOption) : undefined); - message.initChain !== undefined && - (obj.initChain = message.initChain ? ResponseInitChain.toJSON(message.initChain) : undefined); - message.query !== undefined && - (obj.query = message.query ? ResponseQuery.toJSON(message.query) : undefined); - message.beginBlock !== undefined && - (obj.beginBlock = message.beginBlock ? ResponseBeginBlock.toJSON(message.beginBlock) : undefined); - message.checkTx !== undefined && - (obj.checkTx = message.checkTx ? ResponseCheckTx.toJSON(message.checkTx) : undefined); - message.deliverTx !== undefined && - (obj.deliverTx = message.deliverTx ? ResponseDeliverTx.toJSON(message.deliverTx) : undefined); - message.endBlock !== undefined && - (obj.endBlock = message.endBlock ? ResponseEndBlock.toJSON(message.endBlock) : undefined); - message.commit !== undefined && - (obj.commit = message.commit ? ResponseCommit.toJSON(message.commit) : undefined); - message.listSnapshots !== undefined && - (obj.listSnapshots = message.listSnapshots - ? ResponseListSnapshots.toJSON(message.listSnapshots) - : undefined); - message.offerSnapshot !== undefined && - (obj.offerSnapshot = message.offerSnapshot - ? ResponseOfferSnapshot.toJSON(message.offerSnapshot) - : undefined); - message.loadSnapshotChunk !== undefined && - (obj.loadSnapshotChunk = message.loadSnapshotChunk - ? ResponseLoadSnapshotChunk.toJSON(message.loadSnapshotChunk) - : undefined); - message.applySnapshotChunk !== undefined && - (obj.applySnapshotChunk = message.applySnapshotChunk - ? ResponseApplySnapshotChunk.toJSON(message.applySnapshotChunk) - : undefined); - return obj; - }, }; const baseResponseException: object = { error: "" }; export const ResponseException = { encode(message: ResponseException, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.error); + if (message.error !== "") { + writer.uint32(10).string(message.error); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): ResponseException { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseResponseException) as ResponseException; + const message = { ...baseResponseException } as ResponseException; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -2288,19 +2340,9 @@ export const ResponseException = { }, fromJSON(object: any): ResponseException { - const message = Object.create(baseResponseException) as ResponseException; - if (object.error !== undefined && object.error !== null) { - message.error = String(object.error); - } else { - message.error = ""; - } - return message; - }, - - fromPartial(object: DeepPartial): ResponseException { const message = { ...baseResponseException } as ResponseException; if (object.error !== undefined && object.error !== null) { - message.error = object.error; + message.error = String(object.error); } else { message.error = ""; } @@ -2312,20 +2354,32 @@ export const ResponseException = { message.error !== undefined && (obj.error = message.error); return obj; }, + + fromPartial(object: DeepPartial): ResponseException { + const message = { ...baseResponseException } as ResponseException; + if (object.error !== undefined && object.error !== null) { + message.error = object.error; + } else { + message.error = ""; + } + return message; + }, }; const baseResponseEcho: object = { message: "" }; export const ResponseEcho = { encode(message: ResponseEcho, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.message); + if (message.message !== "") { + writer.uint32(10).string(message.message); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): ResponseEcho { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseResponseEcho) as ResponseEcho; + const message = { ...baseResponseEcho } as ResponseEcho; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -2341,19 +2395,9 @@ export const ResponseEcho = { }, fromJSON(object: any): ResponseEcho { - const message = Object.create(baseResponseEcho) as ResponseEcho; - if (object.message !== undefined && object.message !== null) { - message.message = String(object.message); - } else { - message.message = ""; - } - return message; - }, - - fromPartial(object: DeepPartial): ResponseEcho { const message = { ...baseResponseEcho } as ResponseEcho; if (object.message !== undefined && object.message !== null) { - message.message = object.message; + message.message = String(object.message); } else { message.message = ""; } @@ -2365,6 +2409,16 @@ export const ResponseEcho = { message.message !== undefined && (obj.message = message.message); return obj; }, + + fromPartial(object: DeepPartial): ResponseEcho { + const message = { ...baseResponseEcho } as ResponseEcho; + if (object.message !== undefined && object.message !== null) { + message.message = object.message; + } else { + message.message = ""; + } + return message; + }, }; const baseResponseFlush: object = {}; @@ -2377,7 +2431,7 @@ export const ResponseFlush = { decode(input: _m0.Reader | Uint8Array, length?: number): ResponseFlush { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseResponseFlush) as ResponseFlush; + const message = { ...baseResponseFlush } as ResponseFlush; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -2390,11 +2444,6 @@ export const ResponseFlush = { }, fromJSON(_: any): ResponseFlush { - const message = Object.create(baseResponseFlush) as ResponseFlush; - return message; - }, - - fromPartial(_: DeepPartial): ResponseFlush { const message = { ...baseResponseFlush } as ResponseFlush; return message; }, @@ -2403,6 +2452,11 @@ export const ResponseFlush = { const obj: any = {}; return obj; }, + + fromPartial(_: DeepPartial): ResponseFlush { + const message = { ...baseResponseFlush } as ResponseFlush; + return message; + }, }; const baseResponseInfo: object = { @@ -2414,18 +2468,28 @@ const baseResponseInfo: object = { export const ResponseInfo = { encode(message: ResponseInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.data); - writer.uint32(18).string(message.version); - writer.uint32(24).uint64(message.appVersion); - writer.uint32(32).int64(message.lastBlockHeight); - writer.uint32(42).bytes(message.lastBlockAppHash); + if (message.data !== "") { + writer.uint32(10).string(message.data); + } + if (message.version !== "") { + writer.uint32(18).string(message.version); + } + if (!message.appVersion.isZero()) { + writer.uint32(24).uint64(message.appVersion); + } + if (!message.lastBlockHeight.isZero()) { + writer.uint32(32).int64(message.lastBlockHeight); + } + if (message.lastBlockAppHash.length !== 0) { + writer.uint32(42).bytes(message.lastBlockAppHash); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): ResponseInfo { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseResponseInfo) as ResponseInfo; + const message = { ...baseResponseInfo } as ResponseInfo; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -2453,7 +2517,7 @@ export const ResponseInfo = { }, fromJSON(object: any): ResponseInfo { - const message = Object.create(baseResponseInfo) as ResponseInfo; + const message = { ...baseResponseInfo } as ResponseInfo; if (object.data !== undefined && object.data !== null) { message.data = String(object.data); } else { @@ -2480,6 +2544,20 @@ export const ResponseInfo = { return message; }, + toJSON(message: ResponseInfo): unknown { + const obj: any = {}; + message.data !== undefined && (obj.data = message.data); + message.version !== undefined && (obj.version = message.version); + message.appVersion !== undefined && (obj.appVersion = (message.appVersion || Long.UZERO).toString()); + message.lastBlockHeight !== undefined && + (obj.lastBlockHeight = (message.lastBlockHeight || Long.ZERO).toString()); + message.lastBlockAppHash !== undefined && + (obj.lastBlockAppHash = base64FromBytes( + message.lastBlockAppHash !== undefined ? message.lastBlockAppHash : new Uint8Array(), + )); + return obj; + }, + fromPartial(object: DeepPartial): ResponseInfo { const message = { ...baseResponseInfo } as ResponseInfo; if (object.data !== undefined && object.data !== null) { @@ -2509,36 +2587,28 @@ export const ResponseInfo = { } return message; }, - - toJSON(message: ResponseInfo): unknown { - const obj: any = {}; - message.data !== undefined && (obj.data = message.data); - message.version !== undefined && (obj.version = message.version); - message.appVersion !== undefined && (obj.appVersion = (message.appVersion || Long.UZERO).toString()); - message.lastBlockHeight !== undefined && - (obj.lastBlockHeight = (message.lastBlockHeight || Long.ZERO).toString()); - message.lastBlockAppHash !== undefined && - (obj.lastBlockAppHash = base64FromBytes( - message.lastBlockAppHash !== undefined ? message.lastBlockAppHash : new Uint8Array(), - )); - return obj; - }, }; const baseResponseSetOption: object = { code: 0, log: "", info: "" }; export const ResponseSetOption = { encode(message: ResponseSetOption, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).uint32(message.code); - writer.uint32(26).string(message.log); - writer.uint32(34).string(message.info); + if (message.code !== 0) { + writer.uint32(8).uint32(message.code); + } + if (message.log !== "") { + writer.uint32(26).string(message.log); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): ResponseSetOption { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseResponseSetOption) as ResponseSetOption; + const message = { ...baseResponseSetOption } as ResponseSetOption; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -2560,7 +2630,7 @@ export const ResponseSetOption = { }, fromJSON(object: any): ResponseSetOption { - const message = Object.create(baseResponseSetOption) as ResponseSetOption; + const message = { ...baseResponseSetOption } as ResponseSetOption; if (object.code !== undefined && object.code !== null) { message.code = Number(object.code); } else { @@ -2579,6 +2649,14 @@ export const ResponseSetOption = { return message; }, + toJSON(message: ResponseSetOption): unknown { + const obj: any = {}; + message.code !== undefined && (obj.code = message.code); + message.log !== undefined && (obj.log = message.log); + message.info !== undefined && (obj.info = message.info); + return obj; + }, + fromPartial(object: DeepPartial): ResponseSetOption { const message = { ...baseResponseSetOption } as ResponseSetOption; if (object.code !== undefined && object.code !== null) { @@ -2598,14 +2676,6 @@ export const ResponseSetOption = { } return message; }, - - toJSON(message: ResponseSetOption): unknown { - const obj: any = {}; - message.code !== undefined && (obj.code = message.code); - message.log !== undefined && (obj.log = message.log); - message.info !== undefined && (obj.info = message.info); - return obj; - }, }; const baseResponseInitChain: object = {}; @@ -2618,14 +2688,16 @@ export const ResponseInitChain = { for (const v of message.validators) { ValidatorUpdate.encode(v!, writer.uint32(18).fork()).ldelim(); } - writer.uint32(26).bytes(message.appHash); + if (message.appHash.length !== 0) { + writer.uint32(26).bytes(message.appHash); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): ResponseInitChain { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseResponseInitChain) as ResponseInitChain; + const message = { ...baseResponseInitChain } as ResponseInitChain; message.validators = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -2648,7 +2720,7 @@ export const ResponseInitChain = { }, fromJSON(object: any): ResponseInitChain { - const message = Object.create(baseResponseInitChain) as ResponseInitChain; + const message = { ...baseResponseInitChain } as ResponseInitChain; message.validators = []; if (object.consensusParams !== undefined && object.consensusParams !== null) { message.consensusParams = ConsensusParams.fromJSON(object.consensusParams); @@ -2666,6 +2738,22 @@ export const ResponseInitChain = { return message; }, + toJSON(message: ResponseInitChain): unknown { + const obj: any = {}; + message.consensusParams !== undefined && + (obj.consensusParams = message.consensusParams + ? ConsensusParams.toJSON(message.consensusParams) + : undefined); + if (message.validators) { + obj.validators = message.validators.map((e) => (e ? ValidatorUpdate.toJSON(e) : undefined)); + } else { + obj.validators = []; + } + message.appHash !== undefined && + (obj.appHash = base64FromBytes(message.appHash !== undefined ? message.appHash : new Uint8Array())); + return obj; + }, + fromPartial(object: DeepPartial): ResponseInitChain { const message = { ...baseResponseInitChain } as ResponseInitChain; message.validators = []; @@ -2686,22 +2774,6 @@ export const ResponseInitChain = { } return message; }, - - toJSON(message: ResponseInitChain): unknown { - const obj: any = {}; - message.consensusParams !== undefined && - (obj.consensusParams = message.consensusParams - ? ConsensusParams.toJSON(message.consensusParams) - : undefined); - if (message.validators) { - obj.validators = message.validators.map((e) => (e ? ValidatorUpdate.toJSON(e) : undefined)); - } else { - obj.validators = []; - } - message.appHash !== undefined && - (obj.appHash = base64FromBytes(message.appHash !== undefined ? message.appHash : new Uint8Array())); - return obj; - }, }; const baseResponseQuery: object = { @@ -2715,24 +2787,40 @@ const baseResponseQuery: object = { export const ResponseQuery = { encode(message: ResponseQuery, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).uint32(message.code); - writer.uint32(26).string(message.log); - writer.uint32(34).string(message.info); - writer.uint32(40).int64(message.index); - writer.uint32(50).bytes(message.key); - writer.uint32(58).bytes(message.value); + if (message.code !== 0) { + writer.uint32(8).uint32(message.code); + } + if (message.log !== "") { + writer.uint32(26).string(message.log); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } + if (!message.index.isZero()) { + writer.uint32(40).int64(message.index); + } + if (message.key.length !== 0) { + writer.uint32(50).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(58).bytes(message.value); + } if (message.proofOps !== undefined) { ProofOps.encode(message.proofOps, writer.uint32(66).fork()).ldelim(); } - writer.uint32(72).int64(message.height); - writer.uint32(82).string(message.codespace); + if (!message.height.isZero()) { + writer.uint32(72).int64(message.height); + } + if (message.codespace !== "") { + writer.uint32(82).string(message.codespace); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): ResponseQuery { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseResponseQuery) as ResponseQuery; + const message = { ...baseResponseQuery } as ResponseQuery; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -2772,7 +2860,7 @@ export const ResponseQuery = { }, fromJSON(object: any): ResponseQuery { - const message = Object.create(baseResponseQuery) as ResponseQuery; + const message = { ...baseResponseQuery } as ResponseQuery; if (object.code !== undefined && object.code !== null) { message.code = Number(object.code); } else { @@ -2817,6 +2905,23 @@ export const ResponseQuery = { return message; }, + toJSON(message: ResponseQuery): unknown { + const obj: any = {}; + message.code !== undefined && (obj.code = message.code); + message.log !== undefined && (obj.log = message.log); + message.info !== undefined && (obj.info = message.info); + message.index !== undefined && (obj.index = (message.index || Long.ZERO).toString()); + message.key !== undefined && + (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); + message.value !== undefined && + (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); + message.proofOps !== undefined && + (obj.proofOps = message.proofOps ? ProofOps.toJSON(message.proofOps) : undefined); + message.height !== undefined && (obj.height = (message.height || Long.ZERO).toString()); + message.codespace !== undefined && (obj.codespace = message.codespace); + return obj; + }, + fromPartial(object: DeepPartial): ResponseQuery { const message = { ...baseResponseQuery } as ResponseQuery; if (object.code !== undefined && object.code !== null) { @@ -2866,23 +2971,6 @@ export const ResponseQuery = { } return message; }, - - toJSON(message: ResponseQuery): unknown { - const obj: any = {}; - message.code !== undefined && (obj.code = message.code); - message.log !== undefined && (obj.log = message.log); - message.info !== undefined && (obj.info = message.info); - message.index !== undefined && (obj.index = (message.index || Long.ZERO).toString()); - message.key !== undefined && - (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); - message.value !== undefined && - (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); - message.proofOps !== undefined && - (obj.proofOps = message.proofOps ? ProofOps.toJSON(message.proofOps) : undefined); - message.height !== undefined && (obj.height = (message.height || Long.ZERO).toString()); - message.codespace !== undefined && (obj.codespace = message.codespace); - return obj; - }, }; const baseResponseBeginBlock: object = {}; @@ -2898,7 +2986,7 @@ export const ResponseBeginBlock = { decode(input: _m0.Reader | Uint8Array, length?: number): ResponseBeginBlock { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseResponseBeginBlock) as ResponseBeginBlock; + const message = { ...baseResponseBeginBlock } as ResponseBeginBlock; message.events = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -2915,22 +3003,11 @@ export const ResponseBeginBlock = { }, fromJSON(object: any): ResponseBeginBlock { - const message = Object.create(baseResponseBeginBlock) as ResponseBeginBlock; - message.events = []; - if (object.events !== undefined && object.events !== null) { - for (const e of object.events) { - message.events.push(Event.fromJSON(e)); - } - } - return message; - }, - - fromPartial(object: DeepPartial): ResponseBeginBlock { const message = { ...baseResponseBeginBlock } as ResponseBeginBlock; message.events = []; if (object.events !== undefined && object.events !== null) { for (const e of object.events) { - message.events.push(Event.fromPartial(e)); + message.events.push(Event.fromJSON(e)); } } return message; @@ -2945,6 +3022,17 @@ export const ResponseBeginBlock = { } return obj; }, + + fromPartial(object: DeepPartial): ResponseBeginBlock { + const message = { ...baseResponseBeginBlock } as ResponseBeginBlock; + message.events = []; + if (object.events !== undefined && object.events !== null) { + for (const e of object.events) { + message.events.push(Event.fromPartial(e)); + } + } + return message; + }, }; const baseResponseCheckTx: object = { @@ -2958,23 +3046,37 @@ const baseResponseCheckTx: object = { export const ResponseCheckTx = { encode(message: ResponseCheckTx, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).uint32(message.code); - writer.uint32(18).bytes(message.data); - writer.uint32(26).string(message.log); - writer.uint32(34).string(message.info); - writer.uint32(40).int64(message.gasWanted); - writer.uint32(48).int64(message.gasUsed); + if (message.code !== 0) { + writer.uint32(8).uint32(message.code); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + if (message.log !== "") { + writer.uint32(26).string(message.log); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } + if (!message.gasWanted.isZero()) { + writer.uint32(40).int64(message.gasWanted); + } + if (!message.gasUsed.isZero()) { + writer.uint32(48).int64(message.gasUsed); + } for (const v of message.events) { Event.encode(v!, writer.uint32(58).fork()).ldelim(); } - writer.uint32(66).string(message.codespace); + if (message.codespace !== "") { + writer.uint32(66).string(message.codespace); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): ResponseCheckTx { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseResponseCheckTx) as ResponseCheckTx; + const message = { ...baseResponseCheckTx } as ResponseCheckTx; message.events = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -3012,7 +3114,7 @@ export const ResponseCheckTx = { }, fromJSON(object: any): ResponseCheckTx { - const message = Object.create(baseResponseCheckTx) as ResponseCheckTx; + const message = { ...baseResponseCheckTx } as ResponseCheckTx; message.events = []; if (object.code !== undefined && object.code !== null) { message.code = Number(object.code); @@ -3055,6 +3157,24 @@ export const ResponseCheckTx = { return message; }, + toJSON(message: ResponseCheckTx): unknown { + const obj: any = {}; + message.code !== undefined && (obj.code = message.code); + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); + message.log !== undefined && (obj.log = message.log); + message.info !== undefined && (obj.info = message.info); + message.gasWanted !== undefined && (obj.gasWanted = (message.gasWanted || Long.ZERO).toString()); + message.gasUsed !== undefined && (obj.gasUsed = (message.gasUsed || Long.ZERO).toString()); + if (message.events) { + obj.events = message.events.map((e) => (e ? Event.toJSON(e) : undefined)); + } else { + obj.events = []; + } + message.codespace !== undefined && (obj.codespace = message.codespace); + return obj; + }, + fromPartial(object: DeepPartial): ResponseCheckTx { const message = { ...baseResponseCheckTx } as ResponseCheckTx; message.events = []; @@ -3100,24 +3220,6 @@ export const ResponseCheckTx = { } return message; }, - - toJSON(message: ResponseCheckTx): unknown { - const obj: any = {}; - message.code !== undefined && (obj.code = message.code); - message.data !== undefined && - (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); - message.log !== undefined && (obj.log = message.log); - message.info !== undefined && (obj.info = message.info); - message.gasWanted !== undefined && (obj.gasWanted = (message.gasWanted || Long.ZERO).toString()); - message.gasUsed !== undefined && (obj.gasUsed = (message.gasUsed || Long.ZERO).toString()); - if (message.events) { - obj.events = message.events.map((e) => (e ? Event.toJSON(e) : undefined)); - } else { - obj.events = []; - } - message.codespace !== undefined && (obj.codespace = message.codespace); - return obj; - }, }; const baseResponseDeliverTx: object = { @@ -3131,23 +3233,37 @@ const baseResponseDeliverTx: object = { export const ResponseDeliverTx = { encode(message: ResponseDeliverTx, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).uint32(message.code); - writer.uint32(18).bytes(message.data); - writer.uint32(26).string(message.log); - writer.uint32(34).string(message.info); - writer.uint32(40).int64(message.gasWanted); - writer.uint32(48).int64(message.gasUsed); + if (message.code !== 0) { + writer.uint32(8).uint32(message.code); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + if (message.log !== "") { + writer.uint32(26).string(message.log); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } + if (!message.gasWanted.isZero()) { + writer.uint32(40).int64(message.gasWanted); + } + if (!message.gasUsed.isZero()) { + writer.uint32(48).int64(message.gasUsed); + } for (const v of message.events) { Event.encode(v!, writer.uint32(58).fork()).ldelim(); } - writer.uint32(66).string(message.codespace); + if (message.codespace !== "") { + writer.uint32(66).string(message.codespace); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): ResponseDeliverTx { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseResponseDeliverTx) as ResponseDeliverTx; + const message = { ...baseResponseDeliverTx } as ResponseDeliverTx; message.events = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -3185,7 +3301,7 @@ export const ResponseDeliverTx = { }, fromJSON(object: any): ResponseDeliverTx { - const message = Object.create(baseResponseDeliverTx) as ResponseDeliverTx; + const message = { ...baseResponseDeliverTx } as ResponseDeliverTx; message.events = []; if (object.code !== undefined && object.code !== null) { message.code = Number(object.code); @@ -3228,6 +3344,24 @@ export const ResponseDeliverTx = { return message; }, + toJSON(message: ResponseDeliverTx): unknown { + const obj: any = {}; + message.code !== undefined && (obj.code = message.code); + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); + message.log !== undefined && (obj.log = message.log); + message.info !== undefined && (obj.info = message.info); + message.gasWanted !== undefined && (obj.gasWanted = (message.gasWanted || Long.ZERO).toString()); + message.gasUsed !== undefined && (obj.gasUsed = (message.gasUsed || Long.ZERO).toString()); + if (message.events) { + obj.events = message.events.map((e) => (e ? Event.toJSON(e) : undefined)); + } else { + obj.events = []; + } + message.codespace !== undefined && (obj.codespace = message.codespace); + return obj; + }, + fromPartial(object: DeepPartial): ResponseDeliverTx { const message = { ...baseResponseDeliverTx } as ResponseDeliverTx; message.events = []; @@ -3273,24 +3407,6 @@ export const ResponseDeliverTx = { } return message; }, - - toJSON(message: ResponseDeliverTx): unknown { - const obj: any = {}; - message.code !== undefined && (obj.code = message.code); - message.data !== undefined && - (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); - message.log !== undefined && (obj.log = message.log); - message.info !== undefined && (obj.info = message.info); - message.gasWanted !== undefined && (obj.gasWanted = (message.gasWanted || Long.ZERO).toString()); - message.gasUsed !== undefined && (obj.gasUsed = (message.gasUsed || Long.ZERO).toString()); - if (message.events) { - obj.events = message.events.map((e) => (e ? Event.toJSON(e) : undefined)); - } else { - obj.events = []; - } - message.codespace !== undefined && (obj.codespace = message.codespace); - return obj; - }, }; const baseResponseEndBlock: object = {}; @@ -3312,7 +3428,7 @@ export const ResponseEndBlock = { decode(input: _m0.Reader | Uint8Array, length?: number): ResponseEndBlock { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseResponseEndBlock) as ResponseEndBlock; + const message = { ...baseResponseEndBlock } as ResponseEndBlock; message.validatorUpdates = []; message.events = []; while (reader.pos < end) { @@ -3336,7 +3452,7 @@ export const ResponseEndBlock = { }, fromJSON(object: any): ResponseEndBlock { - const message = Object.create(baseResponseEndBlock) as ResponseEndBlock; + const message = { ...baseResponseEndBlock } as ResponseEndBlock; message.validatorUpdates = []; message.events = []; if (object.validatorUpdates !== undefined && object.validatorUpdates !== null) { @@ -3357,28 +3473,6 @@ export const ResponseEndBlock = { return message; }, - fromPartial(object: DeepPartial): ResponseEndBlock { - const message = { ...baseResponseEndBlock } as ResponseEndBlock; - message.validatorUpdates = []; - message.events = []; - if (object.validatorUpdates !== undefined && object.validatorUpdates !== null) { - for (const e of object.validatorUpdates) { - message.validatorUpdates.push(ValidatorUpdate.fromPartial(e)); - } - } - if (object.consensusParamUpdates !== undefined && object.consensusParamUpdates !== null) { - message.consensusParamUpdates = ConsensusParams.fromPartial(object.consensusParamUpdates); - } else { - message.consensusParamUpdates = undefined; - } - if (object.events !== undefined && object.events !== null) { - for (const e of object.events) { - message.events.push(Event.fromPartial(e)); - } - } - return message; - }, - toJSON(message: ResponseEndBlock): unknown { const obj: any = {}; if (message.validatorUpdates) { @@ -3397,21 +3491,47 @@ export const ResponseEndBlock = { } return obj; }, + + fromPartial(object: DeepPartial): ResponseEndBlock { + const message = { ...baseResponseEndBlock } as ResponseEndBlock; + message.validatorUpdates = []; + message.events = []; + if (object.validatorUpdates !== undefined && object.validatorUpdates !== null) { + for (const e of object.validatorUpdates) { + message.validatorUpdates.push(ValidatorUpdate.fromPartial(e)); + } + } + if (object.consensusParamUpdates !== undefined && object.consensusParamUpdates !== null) { + message.consensusParamUpdates = ConsensusParams.fromPartial(object.consensusParamUpdates); + } else { + message.consensusParamUpdates = undefined; + } + if (object.events !== undefined && object.events !== null) { + for (const e of object.events) { + message.events.push(Event.fromPartial(e)); + } + } + return message; + }, }; const baseResponseCommit: object = { retainHeight: Long.ZERO }; export const ResponseCommit = { encode(message: ResponseCommit, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(18).bytes(message.data); - writer.uint32(24).int64(message.retainHeight); + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + if (!message.retainHeight.isZero()) { + writer.uint32(24).int64(message.retainHeight); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): ResponseCommit { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseResponseCommit) as ResponseCommit; + const message = { ...baseResponseCommit } as ResponseCommit; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -3430,7 +3550,7 @@ export const ResponseCommit = { }, fromJSON(object: any): ResponseCommit { - const message = Object.create(baseResponseCommit) as ResponseCommit; + const message = { ...baseResponseCommit } as ResponseCommit; if (object.data !== undefined && object.data !== null) { message.data = bytesFromBase64(object.data); } @@ -3442,6 +3562,14 @@ export const ResponseCommit = { return message; }, + toJSON(message: ResponseCommit): unknown { + const obj: any = {}; + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); + message.retainHeight !== undefined && (obj.retainHeight = (message.retainHeight || Long.ZERO).toString()); + return obj; + }, + fromPartial(object: DeepPartial): ResponseCommit { const message = { ...baseResponseCommit } as ResponseCommit; if (object.data !== undefined && object.data !== null) { @@ -3456,14 +3584,6 @@ export const ResponseCommit = { } return message; }, - - toJSON(message: ResponseCommit): unknown { - const obj: any = {}; - message.data !== undefined && - (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); - message.retainHeight !== undefined && (obj.retainHeight = (message.retainHeight || Long.ZERO).toString()); - return obj; - }, }; const baseResponseListSnapshots: object = {}; @@ -3479,7 +3599,7 @@ export const ResponseListSnapshots = { decode(input: _m0.Reader | Uint8Array, length?: number): ResponseListSnapshots { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseResponseListSnapshots) as ResponseListSnapshots; + const message = { ...baseResponseListSnapshots } as ResponseListSnapshots; message.snapshots = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -3496,22 +3616,11 @@ export const ResponseListSnapshots = { }, fromJSON(object: any): ResponseListSnapshots { - const message = Object.create(baseResponseListSnapshots) as ResponseListSnapshots; - message.snapshots = []; - if (object.snapshots !== undefined && object.snapshots !== null) { - for (const e of object.snapshots) { - message.snapshots.push(Snapshot.fromJSON(e)); - } - } - return message; - }, - - fromPartial(object: DeepPartial): ResponseListSnapshots { const message = { ...baseResponseListSnapshots } as ResponseListSnapshots; message.snapshots = []; if (object.snapshots !== undefined && object.snapshots !== null) { for (const e of object.snapshots) { - message.snapshots.push(Snapshot.fromPartial(e)); + message.snapshots.push(Snapshot.fromJSON(e)); } } return message; @@ -3526,20 +3635,33 @@ export const ResponseListSnapshots = { } return obj; }, + + fromPartial(object: DeepPartial): ResponseListSnapshots { + const message = { ...baseResponseListSnapshots } as ResponseListSnapshots; + message.snapshots = []; + if (object.snapshots !== undefined && object.snapshots !== null) { + for (const e of object.snapshots) { + message.snapshots.push(Snapshot.fromPartial(e)); + } + } + return message; + }, }; const baseResponseOfferSnapshot: object = { result: 0 }; export const ResponseOfferSnapshot = { encode(message: ResponseOfferSnapshot, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).int32(message.result); + if (message.result !== 0) { + writer.uint32(8).int32(message.result); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): ResponseOfferSnapshot { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseResponseOfferSnapshot) as ResponseOfferSnapshot; + const message = { ...baseResponseOfferSnapshot } as ResponseOfferSnapshot; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -3555,19 +3677,9 @@ export const ResponseOfferSnapshot = { }, fromJSON(object: any): ResponseOfferSnapshot { - const message = Object.create(baseResponseOfferSnapshot) as ResponseOfferSnapshot; - if (object.result !== undefined && object.result !== null) { - message.result = responseOfferSnapshot_ResultFromJSON(object.result); - } else { - message.result = 0; - } - return message; - }, - - fromPartial(object: DeepPartial): ResponseOfferSnapshot { const message = { ...baseResponseOfferSnapshot } as ResponseOfferSnapshot; if (object.result !== undefined && object.result !== null) { - message.result = object.result; + message.result = responseOfferSnapshot_ResultFromJSON(object.result); } else { message.result = 0; } @@ -3579,20 +3691,32 @@ export const ResponseOfferSnapshot = { message.result !== undefined && (obj.result = responseOfferSnapshot_ResultToJSON(message.result)); return obj; }, + + fromPartial(object: DeepPartial): ResponseOfferSnapshot { + const message = { ...baseResponseOfferSnapshot } as ResponseOfferSnapshot; + if (object.result !== undefined && object.result !== null) { + message.result = object.result; + } else { + message.result = 0; + } + return message; + }, }; const baseResponseLoadSnapshotChunk: object = {}; export const ResponseLoadSnapshotChunk = { encode(message: ResponseLoadSnapshotChunk, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).bytes(message.chunk); + if (message.chunk.length !== 0) { + writer.uint32(10).bytes(message.chunk); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): ResponseLoadSnapshotChunk { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseResponseLoadSnapshotChunk) as ResponseLoadSnapshotChunk; + const message = { ...baseResponseLoadSnapshotChunk } as ResponseLoadSnapshotChunk; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -3608,13 +3732,20 @@ export const ResponseLoadSnapshotChunk = { }, fromJSON(object: any): ResponseLoadSnapshotChunk { - const message = Object.create(baseResponseLoadSnapshotChunk) as ResponseLoadSnapshotChunk; + const message = { ...baseResponseLoadSnapshotChunk } as ResponseLoadSnapshotChunk; if (object.chunk !== undefined && object.chunk !== null) { message.chunk = bytesFromBase64(object.chunk); } return message; }, + toJSON(message: ResponseLoadSnapshotChunk): unknown { + const obj: any = {}; + message.chunk !== undefined && + (obj.chunk = base64FromBytes(message.chunk !== undefined ? message.chunk : new Uint8Array())); + return obj; + }, + fromPartial(object: DeepPartial): ResponseLoadSnapshotChunk { const message = { ...baseResponseLoadSnapshotChunk } as ResponseLoadSnapshotChunk; if (object.chunk !== undefined && object.chunk !== null) { @@ -3624,20 +3755,15 @@ export const ResponseLoadSnapshotChunk = { } return message; }, - - toJSON(message: ResponseLoadSnapshotChunk): unknown { - const obj: any = {}; - message.chunk !== undefined && - (obj.chunk = base64FromBytes(message.chunk !== undefined ? message.chunk : new Uint8Array())); - return obj; - }, }; const baseResponseApplySnapshotChunk: object = { result: 0, refetchChunks: 0, rejectSenders: "" }; export const ResponseApplySnapshotChunk = { encode(message: ResponseApplySnapshotChunk, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).int32(message.result); + if (message.result !== 0) { + writer.uint32(8).int32(message.result); + } writer.uint32(18).fork(); for (const v of message.refetchChunks) { writer.uint32(v); @@ -3652,7 +3778,7 @@ export const ResponseApplySnapshotChunk = { decode(input: _m0.Reader | Uint8Array, length?: number): ResponseApplySnapshotChunk { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseResponseApplySnapshotChunk) as ResponseApplySnapshotChunk; + const message = { ...baseResponseApplySnapshotChunk } as ResponseApplySnapshotChunk; message.refetchChunks = []; message.rejectSenders = []; while (reader.pos < end) { @@ -3683,7 +3809,7 @@ export const ResponseApplySnapshotChunk = { }, fromJSON(object: any): ResponseApplySnapshotChunk { - const message = Object.create(baseResponseApplySnapshotChunk) as ResponseApplySnapshotChunk; + const message = { ...baseResponseApplySnapshotChunk } as ResponseApplySnapshotChunk; message.refetchChunks = []; message.rejectSenders = []; if (object.result !== undefined && object.result !== null) { @@ -3704,6 +3830,22 @@ export const ResponseApplySnapshotChunk = { return message; }, + toJSON(message: ResponseApplySnapshotChunk): unknown { + const obj: any = {}; + message.result !== undefined && (obj.result = responseApplySnapshotChunk_ResultToJSON(message.result)); + if (message.refetchChunks) { + obj.refetchChunks = message.refetchChunks.map((e) => e); + } else { + obj.refetchChunks = []; + } + if (message.rejectSenders) { + obj.rejectSenders = message.rejectSenders.map((e) => e); + } else { + obj.rejectSenders = []; + } + return obj; + }, + fromPartial(object: DeepPartial): ResponseApplySnapshotChunk { const message = { ...baseResponseApplySnapshotChunk } as ResponseApplySnapshotChunk; message.refetchChunks = []; @@ -3725,22 +3867,6 @@ export const ResponseApplySnapshotChunk = { } return message; }, - - toJSON(message: ResponseApplySnapshotChunk): unknown { - const obj: any = {}; - message.result !== undefined && (obj.result = responseApplySnapshotChunk_ResultToJSON(message.result)); - if (message.refetchChunks) { - obj.refetchChunks = message.refetchChunks.map((e) => e); - } else { - obj.refetchChunks = []; - } - if (message.rejectSenders) { - obj.rejectSenders = message.rejectSenders.map((e) => e); - } else { - obj.rejectSenders = []; - } - return obj; - }, }; const baseConsensusParams: object = {}; @@ -3765,7 +3891,7 @@ export const ConsensusParams = { decode(input: _m0.Reader | Uint8Array, length?: number): ConsensusParams { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseConsensusParams) as ConsensusParams; + const message = { ...baseConsensusParams } as ConsensusParams; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -3790,7 +3916,7 @@ export const ConsensusParams = { }, fromJSON(object: any): ConsensusParams { - const message = Object.create(baseConsensusParams) as ConsensusParams; + const message = { ...baseConsensusParams } as ConsensusParams; if (object.block !== undefined && object.block !== null) { message.block = BlockParams.fromJSON(object.block); } else { @@ -3814,6 +3940,19 @@ export const ConsensusParams = { return message; }, + toJSON(message: ConsensusParams): unknown { + const obj: any = {}; + message.block !== undefined && + (obj.block = message.block ? BlockParams.toJSON(message.block) : undefined); + message.evidence !== undefined && + (obj.evidence = message.evidence ? EvidenceParams.toJSON(message.evidence) : undefined); + message.validator !== undefined && + (obj.validator = message.validator ? ValidatorParams.toJSON(message.validator) : undefined); + message.version !== undefined && + (obj.version = message.version ? VersionParams.toJSON(message.version) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): ConsensusParams { const message = { ...baseConsensusParams } as ConsensusParams; if (object.block !== undefined && object.block !== null) { @@ -3838,34 +3977,25 @@ export const ConsensusParams = { } return message; }, - - toJSON(message: ConsensusParams): unknown { - const obj: any = {}; - message.block !== undefined && - (obj.block = message.block ? BlockParams.toJSON(message.block) : undefined); - message.evidence !== undefined && - (obj.evidence = message.evidence ? EvidenceParams.toJSON(message.evidence) : undefined); - message.validator !== undefined && - (obj.validator = message.validator ? ValidatorParams.toJSON(message.validator) : undefined); - message.version !== undefined && - (obj.version = message.version ? VersionParams.toJSON(message.version) : undefined); - return obj; - }, }; const baseBlockParams: object = { maxBytes: Long.ZERO, maxGas: Long.ZERO }; export const BlockParams = { encode(message: BlockParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).int64(message.maxBytes); - writer.uint32(16).int64(message.maxGas); + if (!message.maxBytes.isZero()) { + writer.uint32(8).int64(message.maxBytes); + } + if (!message.maxGas.isZero()) { + writer.uint32(16).int64(message.maxGas); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): BlockParams { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseBlockParams) as BlockParams; + const message = { ...baseBlockParams } as BlockParams; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -3884,7 +4014,7 @@ export const BlockParams = { }, fromJSON(object: any): BlockParams { - const message = Object.create(baseBlockParams) as BlockParams; + const message = { ...baseBlockParams } as BlockParams; if (object.maxBytes !== undefined && object.maxBytes !== null) { message.maxBytes = Long.fromString(object.maxBytes); } else { @@ -3898,6 +4028,13 @@ export const BlockParams = { return message; }, + toJSON(message: BlockParams): unknown { + const obj: any = {}; + message.maxBytes !== undefined && (obj.maxBytes = (message.maxBytes || Long.ZERO).toString()); + message.maxGas !== undefined && (obj.maxGas = (message.maxGas || Long.ZERO).toString()); + return obj; + }, + fromPartial(object: DeepPartial): BlockParams { const message = { ...baseBlockParams } as BlockParams; if (object.maxBytes !== undefined && object.maxBytes !== null) { @@ -3912,20 +4049,15 @@ export const BlockParams = { } return message; }, - - toJSON(message: BlockParams): unknown { - const obj: any = {}; - message.maxBytes !== undefined && (obj.maxBytes = (message.maxBytes || Long.ZERO).toString()); - message.maxGas !== undefined && (obj.maxGas = (message.maxGas || Long.ZERO).toString()); - return obj; - }, }; const baseLastCommitInfo: object = { round: 0 }; export const LastCommitInfo = { encode(message: LastCommitInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).int32(message.round); + if (message.round !== 0) { + writer.uint32(8).int32(message.round); + } for (const v of message.votes) { VoteInfo.encode(v!, writer.uint32(18).fork()).ldelim(); } @@ -3935,7 +4067,7 @@ export const LastCommitInfo = { decode(input: _m0.Reader | Uint8Array, length?: number): LastCommitInfo { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseLastCommitInfo) as LastCommitInfo; + const message = { ...baseLastCommitInfo } as LastCommitInfo; message.votes = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -3955,7 +4087,7 @@ export const LastCommitInfo = { }, fromJSON(object: any): LastCommitInfo { - const message = Object.create(baseLastCommitInfo) as LastCommitInfo; + const message = { ...baseLastCommitInfo } as LastCommitInfo; message.votes = []; if (object.round !== undefined && object.round !== null) { message.round = Number(object.round); @@ -3970,6 +4102,17 @@ export const LastCommitInfo = { return message; }, + toJSON(message: LastCommitInfo): unknown { + const obj: any = {}; + message.round !== undefined && (obj.round = message.round); + if (message.votes) { + obj.votes = message.votes.map((e) => (e ? VoteInfo.toJSON(e) : undefined)); + } else { + obj.votes = []; + } + return obj; + }, + fromPartial(object: DeepPartial): LastCommitInfo { const message = { ...baseLastCommitInfo } as LastCommitInfo; message.votes = []; @@ -3985,24 +4128,15 @@ export const LastCommitInfo = { } return message; }, - - toJSON(message: LastCommitInfo): unknown { - const obj: any = {}; - message.round !== undefined && (obj.round = message.round); - if (message.votes) { - obj.votes = message.votes.map((e) => (e ? VoteInfo.toJSON(e) : undefined)); - } else { - obj.votes = []; - } - return obj; - }, }; const baseEvent: object = { type: "" }; export const Event = { encode(message: Event, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.type); + if (message.type !== "") { + writer.uint32(10).string(message.type); + } for (const v of message.attributes) { EventAttribute.encode(v!, writer.uint32(18).fork()).ldelim(); } @@ -4012,7 +4146,7 @@ export const Event = { decode(input: _m0.Reader | Uint8Array, length?: number): Event { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseEvent) as Event; + const message = { ...baseEvent } as Event; message.attributes = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -4032,7 +4166,7 @@ export const Event = { }, fromJSON(object: any): Event { - const message = Object.create(baseEvent) as Event; + const message = { ...baseEvent } as Event; message.attributes = []; if (object.type !== undefined && object.type !== null) { message.type = String(object.type); @@ -4047,6 +4181,17 @@ export const Event = { return message; }, + toJSON(message: Event): unknown { + const obj: any = {}; + message.type !== undefined && (obj.type = message.type); + if (message.attributes) { + obj.attributes = message.attributes.map((e) => (e ? EventAttribute.toJSON(e) : undefined)); + } else { + obj.attributes = []; + } + return obj; + }, + fromPartial(object: DeepPartial): Event { const message = { ...baseEvent } as Event; message.attributes = []; @@ -4062,33 +4207,28 @@ export const Event = { } return message; }, - - toJSON(message: Event): unknown { - const obj: any = {}; - message.type !== undefined && (obj.type = message.type); - if (message.attributes) { - obj.attributes = message.attributes.map((e) => (e ? EventAttribute.toJSON(e) : undefined)); - } else { - obj.attributes = []; - } - return obj; - }, }; const baseEventAttribute: object = { index: false }; export const EventAttribute = { encode(message: EventAttribute, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).bytes(message.key); - writer.uint32(18).bytes(message.value); - writer.uint32(24).bool(message.index); + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + if (message.index === true) { + writer.uint32(24).bool(message.index); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): EventAttribute { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseEventAttribute) as EventAttribute; + const message = { ...baseEventAttribute } as EventAttribute; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -4110,7 +4250,7 @@ export const EventAttribute = { }, fromJSON(object: any): EventAttribute { - const message = Object.create(baseEventAttribute) as EventAttribute; + const message = { ...baseEventAttribute } as EventAttribute; if (object.key !== undefined && object.key !== null) { message.key = bytesFromBase64(object.key); } @@ -4125,6 +4265,16 @@ export const EventAttribute = { return message; }, + toJSON(message: EventAttribute): unknown { + const obj: any = {}; + message.key !== undefined && + (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); + message.value !== undefined && + (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); + message.index !== undefined && (obj.index = message.index); + return obj; + }, + fromPartial(object: DeepPartial): EventAttribute { const message = { ...baseEventAttribute } as EventAttribute; if (object.key !== undefined && object.key !== null) { @@ -4144,25 +4294,21 @@ export const EventAttribute = { } return message; }, - - toJSON(message: EventAttribute): unknown { - const obj: any = {}; - message.key !== undefined && - (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); - message.value !== undefined && - (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); - message.index !== undefined && (obj.index = message.index); - return obj; - }, }; const baseTxResult: object = { height: Long.ZERO, index: 0 }; export const TxResult = { encode(message: TxResult, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).int64(message.height); - writer.uint32(16).uint32(message.index); - writer.uint32(26).bytes(message.tx); + if (!message.height.isZero()) { + writer.uint32(8).int64(message.height); + } + if (message.index !== 0) { + writer.uint32(16).uint32(message.index); + } + if (message.tx.length !== 0) { + writer.uint32(26).bytes(message.tx); + } if (message.result !== undefined) { ResponseDeliverTx.encode(message.result, writer.uint32(34).fork()).ldelim(); } @@ -4172,7 +4318,7 @@ export const TxResult = { decode(input: _m0.Reader | Uint8Array, length?: number): TxResult { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseTxResult) as TxResult; + const message = { ...baseTxResult } as TxResult; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -4197,7 +4343,7 @@ export const TxResult = { }, fromJSON(object: any): TxResult { - const message = Object.create(baseTxResult) as TxResult; + const message = { ...baseTxResult } as TxResult; if (object.height !== undefined && object.height !== null) { message.height = Long.fromString(object.height); } else { @@ -4219,6 +4365,17 @@ export const TxResult = { return message; }, + toJSON(message: TxResult): unknown { + const obj: any = {}; + message.height !== undefined && (obj.height = (message.height || Long.ZERO).toString()); + message.index !== undefined && (obj.index = message.index); + message.tx !== undefined && + (obj.tx = base64FromBytes(message.tx !== undefined ? message.tx : new Uint8Array())); + message.result !== undefined && + (obj.result = message.result ? ResponseDeliverTx.toJSON(message.result) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): TxResult { const message = { ...baseTxResult } as TxResult; if (object.height !== undefined && object.height !== null) { @@ -4243,32 +4400,25 @@ export const TxResult = { } return message; }, - - toJSON(message: TxResult): unknown { - const obj: any = {}; - message.height !== undefined && (obj.height = (message.height || Long.ZERO).toString()); - message.index !== undefined && (obj.index = message.index); - message.tx !== undefined && - (obj.tx = base64FromBytes(message.tx !== undefined ? message.tx : new Uint8Array())); - message.result !== undefined && - (obj.result = message.result ? ResponseDeliverTx.toJSON(message.result) : undefined); - return obj; - }, }; const baseValidator: object = { power: Long.ZERO }; export const Validator = { encode(message: Validator, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).bytes(message.address); - writer.uint32(24).int64(message.power); + if (message.address.length !== 0) { + writer.uint32(10).bytes(message.address); + } + if (!message.power.isZero()) { + writer.uint32(24).int64(message.power); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): Validator { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseValidator) as Validator; + const message = { ...baseValidator } as Validator; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -4287,7 +4437,7 @@ export const Validator = { }, fromJSON(object: any): Validator { - const message = Object.create(baseValidator) as Validator; + const message = { ...baseValidator } as Validator; if (object.address !== undefined && object.address !== null) { message.address = bytesFromBase64(object.address); } @@ -4299,6 +4449,14 @@ export const Validator = { return message; }, + toJSON(message: Validator): unknown { + const obj: any = {}; + message.address !== undefined && + (obj.address = base64FromBytes(message.address !== undefined ? message.address : new Uint8Array())); + message.power !== undefined && (obj.power = (message.power || Long.ZERO).toString()); + return obj; + }, + fromPartial(object: DeepPartial): Validator { const message = { ...baseValidator } as Validator; if (object.address !== undefined && object.address !== null) { @@ -4313,14 +4471,6 @@ export const Validator = { } return message; }, - - toJSON(message: Validator): unknown { - const obj: any = {}; - message.address !== undefined && - (obj.address = base64FromBytes(message.address !== undefined ? message.address : new Uint8Array())); - message.power !== undefined && (obj.power = (message.power || Long.ZERO).toString()); - return obj; - }, }; const baseValidatorUpdate: object = { power: Long.ZERO }; @@ -4330,14 +4480,16 @@ export const ValidatorUpdate = { if (message.pubKey !== undefined) { PublicKey.encode(message.pubKey, writer.uint32(10).fork()).ldelim(); } - writer.uint32(16).int64(message.power); + if (!message.power.isZero()) { + writer.uint32(16).int64(message.power); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorUpdate { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseValidatorUpdate) as ValidatorUpdate; + const message = { ...baseValidatorUpdate } as ValidatorUpdate; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -4356,7 +4508,7 @@ export const ValidatorUpdate = { }, fromJSON(object: any): ValidatorUpdate { - const message = Object.create(baseValidatorUpdate) as ValidatorUpdate; + const message = { ...baseValidatorUpdate } as ValidatorUpdate; if (object.pubKey !== undefined && object.pubKey !== null) { message.pubKey = PublicKey.fromJSON(object.pubKey); } else { @@ -4370,6 +4522,14 @@ export const ValidatorUpdate = { return message; }, + toJSON(message: ValidatorUpdate): unknown { + const obj: any = {}; + message.pubKey !== undefined && + (obj.pubKey = message.pubKey ? PublicKey.toJSON(message.pubKey) : undefined); + message.power !== undefined && (obj.power = (message.power || Long.ZERO).toString()); + return obj; + }, + fromPartial(object: DeepPartial): ValidatorUpdate { const message = { ...baseValidatorUpdate } as ValidatorUpdate; if (object.pubKey !== undefined && object.pubKey !== null) { @@ -4384,14 +4544,6 @@ export const ValidatorUpdate = { } return message; }, - - toJSON(message: ValidatorUpdate): unknown { - const obj: any = {}; - message.pubKey !== undefined && - (obj.pubKey = message.pubKey ? PublicKey.toJSON(message.pubKey) : undefined); - message.power !== undefined && (obj.power = (message.power || Long.ZERO).toString()); - return obj; - }, }; const baseVoteInfo: object = { signedLastBlock: false }; @@ -4401,14 +4553,16 @@ export const VoteInfo = { if (message.validator !== undefined) { Validator.encode(message.validator, writer.uint32(10).fork()).ldelim(); } - writer.uint32(16).bool(message.signedLastBlock); + if (message.signedLastBlock === true) { + writer.uint32(16).bool(message.signedLastBlock); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): VoteInfo { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseVoteInfo) as VoteInfo; + const message = { ...baseVoteInfo } as VoteInfo; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -4427,7 +4581,7 @@ export const VoteInfo = { }, fromJSON(object: any): VoteInfo { - const message = Object.create(baseVoteInfo) as VoteInfo; + const message = { ...baseVoteInfo } as VoteInfo; if (object.validator !== undefined && object.validator !== null) { message.validator = Validator.fromJSON(object.validator); } else { @@ -4441,6 +4595,14 @@ export const VoteInfo = { return message; }, + toJSON(message: VoteInfo): unknown { + const obj: any = {}; + message.validator !== undefined && + (obj.validator = message.validator ? Validator.toJSON(message.validator) : undefined); + message.signedLastBlock !== undefined && (obj.signedLastBlock = message.signedLastBlock); + return obj; + }, + fromPartial(object: DeepPartial): VoteInfo { const message = { ...baseVoteInfo } as VoteInfo; if (object.validator !== undefined && object.validator !== null) { @@ -4455,36 +4617,34 @@ export const VoteInfo = { } return message; }, - - toJSON(message: VoteInfo): unknown { - const obj: any = {}; - message.validator !== undefined && - (obj.validator = message.validator ? Validator.toJSON(message.validator) : undefined); - message.signedLastBlock !== undefined && (obj.signedLastBlock = message.signedLastBlock); - return obj; - }, }; const baseEvidence: object = { type: 0, height: Long.ZERO, totalVotingPower: Long.ZERO }; export const Evidence = { encode(message: Evidence, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).int32(message.type); + if (message.type !== 0) { + writer.uint32(8).int32(message.type); + } if (message.validator !== undefined) { Validator.encode(message.validator, writer.uint32(18).fork()).ldelim(); } - writer.uint32(24).int64(message.height); + if (!message.height.isZero()) { + writer.uint32(24).int64(message.height); + } if (message.time !== undefined) { Timestamp.encode(toTimestamp(message.time), writer.uint32(34).fork()).ldelim(); } - writer.uint32(40).int64(message.totalVotingPower); + if (!message.totalVotingPower.isZero()) { + writer.uint32(40).int64(message.totalVotingPower); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): Evidence { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseEvidence) as Evidence; + const message = { ...baseEvidence } as Evidence; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -4512,7 +4672,7 @@ export const Evidence = { }, fromJSON(object: any): Evidence { - const message = Object.create(baseEvidence) as Evidence; + const message = { ...baseEvidence } as Evidence; if (object.type !== undefined && object.type !== null) { message.type = evidenceTypeFromJSON(object.type); } else { @@ -4541,6 +4701,18 @@ export const Evidence = { return message; }, + toJSON(message: Evidence): unknown { + const obj: any = {}; + message.type !== undefined && (obj.type = evidenceTypeToJSON(message.type)); + message.validator !== undefined && + (obj.validator = message.validator ? Validator.toJSON(message.validator) : undefined); + message.height !== undefined && (obj.height = (message.height || Long.ZERO).toString()); + message.time !== undefined && (obj.time = message.time !== undefined ? message.time.toISOString() : null); + message.totalVotingPower !== undefined && + (obj.totalVotingPower = (message.totalVotingPower || Long.ZERO).toString()); + return obj; + }, + fromPartial(object: DeepPartial): Evidence { const message = { ...baseEvidence } as Evidence; if (object.type !== undefined && object.type !== null) { @@ -4570,36 +4742,34 @@ export const Evidence = { } return message; }, - - toJSON(message: Evidence): unknown { - const obj: any = {}; - message.type !== undefined && (obj.type = evidenceTypeToJSON(message.type)); - message.validator !== undefined && - (obj.validator = message.validator ? Validator.toJSON(message.validator) : undefined); - message.height !== undefined && (obj.height = (message.height || Long.ZERO).toString()); - message.time !== undefined && (obj.time = message.time !== undefined ? message.time.toISOString() : null); - message.totalVotingPower !== undefined && - (obj.totalVotingPower = (message.totalVotingPower || Long.ZERO).toString()); - return obj; - }, }; const baseSnapshot: object = { height: Long.UZERO, format: 0, chunks: 0 }; export const Snapshot = { encode(message: Snapshot, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).uint64(message.height); - writer.uint32(16).uint32(message.format); - writer.uint32(24).uint32(message.chunks); - writer.uint32(34).bytes(message.hash); - writer.uint32(42).bytes(message.metadata); + if (!message.height.isZero()) { + writer.uint32(8).uint64(message.height); + } + if (message.format !== 0) { + writer.uint32(16).uint32(message.format); + } + if (message.chunks !== 0) { + writer.uint32(24).uint32(message.chunks); + } + if (message.hash.length !== 0) { + writer.uint32(34).bytes(message.hash); + } + if (message.metadata.length !== 0) { + writer.uint32(42).bytes(message.metadata); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): Snapshot { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseSnapshot) as Snapshot; + const message = { ...baseSnapshot } as Snapshot; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -4627,7 +4797,7 @@ export const Snapshot = { }, fromJSON(object: any): Snapshot { - const message = Object.create(baseSnapshot) as Snapshot; + const message = { ...baseSnapshot } as Snapshot; if (object.height !== undefined && object.height !== null) { message.height = Long.fromString(object.height); } else { @@ -4652,6 +4822,18 @@ export const Snapshot = { return message; }, + toJSON(message: Snapshot): unknown { + const obj: any = {}; + message.height !== undefined && (obj.height = (message.height || Long.UZERO).toString()); + message.format !== undefined && (obj.format = message.format); + message.chunks !== undefined && (obj.chunks = message.chunks); + message.hash !== undefined && + (obj.hash = base64FromBytes(message.hash !== undefined ? message.hash : new Uint8Array())); + message.metadata !== undefined && + (obj.metadata = base64FromBytes(message.metadata !== undefined ? message.metadata : new Uint8Array())); + return obj; + }, + fromPartial(object: DeepPartial): Snapshot { const message = { ...baseSnapshot } as Snapshot; if (object.height !== undefined && object.height !== null) { @@ -4681,18 +4863,6 @@ export const Snapshot = { } return message; }, - - toJSON(message: Snapshot): unknown { - const obj: any = {}; - message.height !== undefined && (obj.height = (message.height || Long.UZERO).toString()); - message.format !== undefined && (obj.format = message.format); - message.chunks !== undefined && (obj.chunks = message.chunks); - message.hash !== undefined && - (obj.hash = base64FromBytes(message.hash !== undefined ? message.hash : new Uint8Array())); - message.metadata !== undefined && - (obj.metadata = base64FromBytes(message.metadata !== undefined ? message.metadata : new Uint8Array())); - return obj; - }, }; export interface ABCIApplication { @@ -4820,7 +4990,7 @@ var globalThis: any = (() => { if (typeof self !== "undefined") return self; if (typeof window !== "undefined") return window; if (typeof global !== "undefined") return global; - throw new Error("Unable to locate global object"); + throw "Unable to locate global object"; })(); const atob: (b64: string) => string = diff --git a/packages/stargate/src/codec/tendermint/crypto/keys.ts b/packages/stargate/src/codec/tendermint/crypto/keys.ts index bfd84961..c0c2302f 100644 --- a/packages/stargate/src/codec/tendermint/crypto/keys.ts +++ b/packages/stargate/src/codec/tendermint/crypto/keys.ts @@ -26,7 +26,7 @@ export const PublicKey = { decode(input: _m0.Reader | Uint8Array, length?: number): PublicKey { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(basePublicKey) as PublicKey; + const message = { ...basePublicKey } as PublicKey; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -45,7 +45,7 @@ export const PublicKey = { }, fromJSON(object: any): PublicKey { - const message = Object.create(basePublicKey) as PublicKey; + const message = { ...basePublicKey } as PublicKey; if (object.ed25519 !== undefined && object.ed25519 !== null) { message.ed25519 = bytesFromBase64(object.ed25519); } @@ -55,6 +55,15 @@ export const PublicKey = { return message; }, + toJSON(message: PublicKey): unknown { + const obj: any = {}; + message.ed25519 !== undefined && + (obj.ed25519 = message.ed25519 !== undefined ? base64FromBytes(message.ed25519) : undefined); + message.secp256k1 !== undefined && + (obj.secp256k1 = message.secp256k1 !== undefined ? base64FromBytes(message.secp256k1) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): PublicKey { const message = { ...basePublicKey } as PublicKey; if (object.ed25519 !== undefined && object.ed25519 !== null) { @@ -69,15 +78,6 @@ export const PublicKey = { } return message; }, - - toJSON(message: PublicKey): unknown { - const obj: any = {}; - message.ed25519 !== undefined && - (obj.ed25519 = message.ed25519 !== undefined ? base64FromBytes(message.ed25519) : undefined); - message.secp256k1 !== undefined && - (obj.secp256k1 = message.secp256k1 !== undefined ? base64FromBytes(message.secp256k1) : undefined); - return obj; - }, }; declare var self: any | undefined; @@ -87,7 +87,7 @@ var globalThis: any = (() => { if (typeof self !== "undefined") return self; if (typeof window !== "undefined") return window; if (typeof global !== "undefined") return global; - throw new Error("Unable to locate global object"); + throw "Unable to locate global object"; })(); const atob: (b64: string) => string = diff --git a/packages/stargate/src/codec/tendermint/crypto/proof.ts b/packages/stargate/src/codec/tendermint/crypto/proof.ts index 4e13a94a..c58f3341 100644 --- a/packages/stargate/src/codec/tendermint/crypto/proof.ts +++ b/packages/stargate/src/codec/tendermint/crypto/proof.ts @@ -44,9 +44,15 @@ const baseProof: object = { total: Long.ZERO, index: Long.ZERO }; export const Proof = { encode(message: Proof, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).int64(message.total); - writer.uint32(16).int64(message.index); - writer.uint32(26).bytes(message.leafHash); + if (!message.total.isZero()) { + writer.uint32(8).int64(message.total); + } + if (!message.index.isZero()) { + writer.uint32(16).int64(message.index); + } + if (message.leafHash.length !== 0) { + writer.uint32(26).bytes(message.leafHash); + } for (const v of message.aunts) { writer.uint32(34).bytes(v!); } @@ -56,7 +62,7 @@ export const Proof = { decode(input: _m0.Reader | Uint8Array, length?: number): Proof { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseProof) as Proof; + const message = { ...baseProof } as Proof; message.aunts = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -82,7 +88,7 @@ export const Proof = { }, fromJSON(object: any): Proof { - const message = Object.create(baseProof) as Proof; + const message = { ...baseProof } as Proof; message.aunts = []; if (object.total !== undefined && object.total !== null) { message.total = Long.fromString(object.total); @@ -105,6 +111,20 @@ export const Proof = { return message; }, + toJSON(message: Proof): unknown { + const obj: any = {}; + message.total !== undefined && (obj.total = (message.total || Long.ZERO).toString()); + message.index !== undefined && (obj.index = (message.index || Long.ZERO).toString()); + message.leafHash !== undefined && + (obj.leafHash = base64FromBytes(message.leafHash !== undefined ? message.leafHash : new Uint8Array())); + if (message.aunts) { + obj.aunts = message.aunts.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.aunts = []; + } + return obj; + }, + fromPartial(object: DeepPartial): Proof { const message = { ...baseProof } as Proof; message.aunts = []; @@ -130,27 +150,15 @@ export const Proof = { } return message; }, - - toJSON(message: Proof): unknown { - const obj: any = {}; - message.total !== undefined && (obj.total = (message.total || Long.ZERO).toString()); - message.index !== undefined && (obj.index = (message.index || Long.ZERO).toString()); - message.leafHash !== undefined && - (obj.leafHash = base64FromBytes(message.leafHash !== undefined ? message.leafHash : new Uint8Array())); - if (message.aunts) { - obj.aunts = message.aunts.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.aunts = []; - } - return obj; - }, }; const baseValueOp: object = {}; export const ValueOp = { encode(message: ValueOp, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).bytes(message.key); + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } if (message.proof !== undefined) { Proof.encode(message.proof, writer.uint32(18).fork()).ldelim(); } @@ -160,7 +168,7 @@ export const ValueOp = { decode(input: _m0.Reader | Uint8Array, length?: number): ValueOp { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseValueOp) as ValueOp; + const message = { ...baseValueOp } as ValueOp; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -179,7 +187,7 @@ export const ValueOp = { }, fromJSON(object: any): ValueOp { - const message = Object.create(baseValueOp) as ValueOp; + const message = { ...baseValueOp } as ValueOp; if (object.key !== undefined && object.key !== null) { message.key = bytesFromBase64(object.key); } @@ -191,6 +199,14 @@ export const ValueOp = { return message; }, + toJSON(message: ValueOp): unknown { + const obj: any = {}; + message.key !== undefined && + (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); + message.proof !== undefined && (obj.proof = message.proof ? Proof.toJSON(message.proof) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): ValueOp { const message = { ...baseValueOp } as ValueOp; if (object.key !== undefined && object.key !== null) { @@ -205,30 +221,28 @@ export const ValueOp = { } return message; }, - - toJSON(message: ValueOp): unknown { - const obj: any = {}; - message.key !== undefined && - (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); - message.proof !== undefined && (obj.proof = message.proof ? Proof.toJSON(message.proof) : undefined); - return obj; - }, }; const baseDominoOp: object = { key: "", input: "", output: "" }; export const DominoOp = { encode(message: DominoOp, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.key); - writer.uint32(18).string(message.input); - writer.uint32(26).string(message.output); + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.input !== "") { + writer.uint32(18).string(message.input); + } + if (message.output !== "") { + writer.uint32(26).string(message.output); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): DominoOp { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseDominoOp) as DominoOp; + const message = { ...baseDominoOp } as DominoOp; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -250,7 +264,7 @@ export const DominoOp = { }, fromJSON(object: any): DominoOp { - const message = Object.create(baseDominoOp) as DominoOp; + const message = { ...baseDominoOp } as DominoOp; if (object.key !== undefined && object.key !== null) { message.key = String(object.key); } else { @@ -269,6 +283,14 @@ export const DominoOp = { return message; }, + toJSON(message: DominoOp): unknown { + const obj: any = {}; + message.key !== undefined && (obj.key = message.key); + message.input !== undefined && (obj.input = message.input); + message.output !== undefined && (obj.output = message.output); + return obj; + }, + fromPartial(object: DeepPartial): DominoOp { const message = { ...baseDominoOp } as DominoOp; if (object.key !== undefined && object.key !== null) { @@ -288,30 +310,28 @@ export const DominoOp = { } return message; }, - - toJSON(message: DominoOp): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = message.key); - message.input !== undefined && (obj.input = message.input); - message.output !== undefined && (obj.output = message.output); - return obj; - }, }; const baseProofOp: object = { type: "" }; export const ProofOp = { encode(message: ProofOp, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).string(message.type); - writer.uint32(18).bytes(message.key); - writer.uint32(26).bytes(message.data); + if (message.type !== "") { + writer.uint32(10).string(message.type); + } + if (message.key.length !== 0) { + writer.uint32(18).bytes(message.key); + } + if (message.data.length !== 0) { + writer.uint32(26).bytes(message.data); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): ProofOp { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseProofOp) as ProofOp; + const message = { ...baseProofOp } as ProofOp; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -333,7 +353,7 @@ export const ProofOp = { }, fromJSON(object: any): ProofOp { - const message = Object.create(baseProofOp) as ProofOp; + const message = { ...baseProofOp } as ProofOp; if (object.type !== undefined && object.type !== null) { message.type = String(object.type); } else { @@ -348,6 +368,16 @@ export const ProofOp = { return message; }, + toJSON(message: ProofOp): unknown { + const obj: any = {}; + message.type !== undefined && (obj.type = message.type); + message.key !== undefined && + (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); + return obj; + }, + fromPartial(object: DeepPartial): ProofOp { const message = { ...baseProofOp } as ProofOp; if (object.type !== undefined && object.type !== null) { @@ -367,16 +397,6 @@ export const ProofOp = { } return message; }, - - toJSON(message: ProofOp): unknown { - const obj: any = {}; - message.type !== undefined && (obj.type = message.type); - message.key !== undefined && - (obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array())); - message.data !== undefined && - (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); - return obj; - }, }; const baseProofOps: object = {}; @@ -392,7 +412,7 @@ export const ProofOps = { decode(input: _m0.Reader | Uint8Array, length?: number): ProofOps { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseProofOps) as ProofOps; + const message = { ...baseProofOps } as ProofOps; message.ops = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -409,22 +429,11 @@ export const ProofOps = { }, fromJSON(object: any): ProofOps { - const message = Object.create(baseProofOps) as ProofOps; - message.ops = []; - if (object.ops !== undefined && object.ops !== null) { - for (const e of object.ops) { - message.ops.push(ProofOp.fromJSON(e)); - } - } - return message; - }, - - fromPartial(object: DeepPartial): ProofOps { const message = { ...baseProofOps } as ProofOps; message.ops = []; if (object.ops !== undefined && object.ops !== null) { for (const e of object.ops) { - message.ops.push(ProofOp.fromPartial(e)); + message.ops.push(ProofOp.fromJSON(e)); } } return message; @@ -439,6 +448,17 @@ export const ProofOps = { } return obj; }, + + fromPartial(object: DeepPartial): ProofOps { + const message = { ...baseProofOps } as ProofOps; + message.ops = []; + if (object.ops !== undefined && object.ops !== null) { + for (const e of object.ops) { + message.ops.push(ProofOp.fromPartial(e)); + } + } + return message; + }, }; declare var self: any | undefined; @@ -448,7 +468,7 @@ var globalThis: any = (() => { if (typeof self !== "undefined") return self; if (typeof window !== "undefined") return window; if (typeof global !== "undefined") return global; - throw new Error("Unable to locate global object"); + throw "Unable to locate global object"; })(); const atob: (b64: string) => string = diff --git a/packages/stargate/src/codec/tendermint/libs/bits/types.ts b/packages/stargate/src/codec/tendermint/libs/bits/types.ts index f8bd027a..6b0ed9c1 100644 --- a/packages/stargate/src/codec/tendermint/libs/bits/types.ts +++ b/packages/stargate/src/codec/tendermint/libs/bits/types.ts @@ -13,7 +13,9 @@ const baseBitArray: object = { bits: Long.ZERO, elems: Long.UZERO }; export const BitArray = { encode(message: BitArray, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).int64(message.bits); + if (!message.bits.isZero()) { + writer.uint32(8).int64(message.bits); + } writer.uint32(18).fork(); for (const v of message.elems) { writer.uint64(v); @@ -25,7 +27,7 @@ export const BitArray = { decode(input: _m0.Reader | Uint8Array, length?: number): BitArray { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseBitArray) as BitArray; + const message = { ...baseBitArray } as BitArray; message.elems = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -52,7 +54,7 @@ export const BitArray = { }, fromJSON(object: any): BitArray { - const message = Object.create(baseBitArray) as BitArray; + const message = { ...baseBitArray } as BitArray; message.elems = []; if (object.bits !== undefined && object.bits !== null) { message.bits = Long.fromString(object.bits); @@ -67,6 +69,17 @@ export const BitArray = { return message; }, + toJSON(message: BitArray): unknown { + const obj: any = {}; + message.bits !== undefined && (obj.bits = (message.bits || Long.ZERO).toString()); + if (message.elems) { + obj.elems = message.elems.map((e) => (e || Long.UZERO).toString()); + } else { + obj.elems = []; + } + return obj; + }, + fromPartial(object: DeepPartial): BitArray { const message = { ...baseBitArray } as BitArray; message.elems = []; @@ -82,17 +95,6 @@ export const BitArray = { } return message; }, - - toJSON(message: BitArray): unknown { - const obj: any = {}; - message.bits !== undefined && (obj.bits = (message.bits || Long.ZERO).toString()); - if (message.elems) { - obj.elems = message.elems.map((e) => (e || Long.UZERO).toString()); - } else { - obj.elems = []; - } - return obj; - }, }; type Builtin = Date | Function | Uint8Array | string | number | undefined | Long; diff --git a/packages/stargate/src/codec/tendermint/types/params.ts b/packages/stargate/src/codec/tendermint/types/params.ts index 29f564de..e8bc7d97 100644 --- a/packages/stargate/src/codec/tendermint/types/params.ts +++ b/packages/stargate/src/codec/tendermint/types/params.ts @@ -107,7 +107,7 @@ export const ConsensusParams = { decode(input: _m0.Reader | Uint8Array, length?: number): ConsensusParams { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseConsensusParams) as ConsensusParams; + const message = { ...baseConsensusParams } as ConsensusParams; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -132,7 +132,7 @@ export const ConsensusParams = { }, fromJSON(object: any): ConsensusParams { - const message = Object.create(baseConsensusParams) as ConsensusParams; + const message = { ...baseConsensusParams } as ConsensusParams; if (object.block !== undefined && object.block !== null) { message.block = BlockParams.fromJSON(object.block); } else { @@ -156,6 +156,19 @@ export const ConsensusParams = { return message; }, + toJSON(message: ConsensusParams): unknown { + const obj: any = {}; + message.block !== undefined && + (obj.block = message.block ? BlockParams.toJSON(message.block) : undefined); + message.evidence !== undefined && + (obj.evidence = message.evidence ? EvidenceParams.toJSON(message.evidence) : undefined); + message.validator !== undefined && + (obj.validator = message.validator ? ValidatorParams.toJSON(message.validator) : undefined); + message.version !== undefined && + (obj.version = message.version ? VersionParams.toJSON(message.version) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): ConsensusParams { const message = { ...baseConsensusParams } as ConsensusParams; if (object.block !== undefined && object.block !== null) { @@ -180,35 +193,28 @@ export const ConsensusParams = { } return message; }, - - toJSON(message: ConsensusParams): unknown { - const obj: any = {}; - message.block !== undefined && - (obj.block = message.block ? BlockParams.toJSON(message.block) : undefined); - message.evidence !== undefined && - (obj.evidence = message.evidence ? EvidenceParams.toJSON(message.evidence) : undefined); - message.validator !== undefined && - (obj.validator = message.validator ? ValidatorParams.toJSON(message.validator) : undefined); - message.version !== undefined && - (obj.version = message.version ? VersionParams.toJSON(message.version) : undefined); - return obj; - }, }; const baseBlockParams: object = { maxBytes: Long.ZERO, maxGas: Long.ZERO, timeIotaMs: Long.ZERO }; export const BlockParams = { encode(message: BlockParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).int64(message.maxBytes); - writer.uint32(16).int64(message.maxGas); - writer.uint32(24).int64(message.timeIotaMs); + if (!message.maxBytes.isZero()) { + writer.uint32(8).int64(message.maxBytes); + } + if (!message.maxGas.isZero()) { + writer.uint32(16).int64(message.maxGas); + } + if (!message.timeIotaMs.isZero()) { + writer.uint32(24).int64(message.timeIotaMs); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): BlockParams { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseBlockParams) as BlockParams; + const message = { ...baseBlockParams } as BlockParams; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -230,7 +236,7 @@ export const BlockParams = { }, fromJSON(object: any): BlockParams { - const message = Object.create(baseBlockParams) as BlockParams; + const message = { ...baseBlockParams } as BlockParams; if (object.maxBytes !== undefined && object.maxBytes !== null) { message.maxBytes = Long.fromString(object.maxBytes); } else { @@ -249,6 +255,14 @@ export const BlockParams = { return message; }, + toJSON(message: BlockParams): unknown { + const obj: any = {}; + message.maxBytes !== undefined && (obj.maxBytes = (message.maxBytes || Long.ZERO).toString()); + message.maxGas !== undefined && (obj.maxGas = (message.maxGas || Long.ZERO).toString()); + message.timeIotaMs !== undefined && (obj.timeIotaMs = (message.timeIotaMs || Long.ZERO).toString()); + return obj; + }, + fromPartial(object: DeepPartial): BlockParams { const message = { ...baseBlockParams } as BlockParams; if (object.maxBytes !== undefined && object.maxBytes !== null) { @@ -268,32 +282,28 @@ export const BlockParams = { } return message; }, - - toJSON(message: BlockParams): unknown { - const obj: any = {}; - message.maxBytes !== undefined && (obj.maxBytes = (message.maxBytes || Long.ZERO).toString()); - message.maxGas !== undefined && (obj.maxGas = (message.maxGas || Long.ZERO).toString()); - message.timeIotaMs !== undefined && (obj.timeIotaMs = (message.timeIotaMs || Long.ZERO).toString()); - return obj; - }, }; const baseEvidenceParams: object = { maxAgeNumBlocks: Long.ZERO, maxBytes: Long.ZERO }; export const EvidenceParams = { encode(message: EvidenceParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).int64(message.maxAgeNumBlocks); + if (!message.maxAgeNumBlocks.isZero()) { + writer.uint32(8).int64(message.maxAgeNumBlocks); + } if (message.maxAgeDuration !== undefined) { Duration.encode(message.maxAgeDuration, writer.uint32(18).fork()).ldelim(); } - writer.uint32(24).int64(message.maxBytes); + if (!message.maxBytes.isZero()) { + writer.uint32(24).int64(message.maxBytes); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): EvidenceParams { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseEvidenceParams) as EvidenceParams; + const message = { ...baseEvidenceParams } as EvidenceParams; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -315,7 +325,7 @@ export const EvidenceParams = { }, fromJSON(object: any): EvidenceParams { - const message = Object.create(baseEvidenceParams) as EvidenceParams; + const message = { ...baseEvidenceParams } as EvidenceParams; if (object.maxAgeNumBlocks !== undefined && object.maxAgeNumBlocks !== null) { message.maxAgeNumBlocks = Long.fromString(object.maxAgeNumBlocks); } else { @@ -334,6 +344,16 @@ export const EvidenceParams = { return message; }, + toJSON(message: EvidenceParams): unknown { + const obj: any = {}; + message.maxAgeNumBlocks !== undefined && + (obj.maxAgeNumBlocks = (message.maxAgeNumBlocks || Long.ZERO).toString()); + message.maxAgeDuration !== undefined && + (obj.maxAgeDuration = message.maxAgeDuration ? Duration.toJSON(message.maxAgeDuration) : undefined); + message.maxBytes !== undefined && (obj.maxBytes = (message.maxBytes || Long.ZERO).toString()); + return obj; + }, + fromPartial(object: DeepPartial): EvidenceParams { const message = { ...baseEvidenceParams } as EvidenceParams; if (object.maxAgeNumBlocks !== undefined && object.maxAgeNumBlocks !== null) { @@ -353,16 +373,6 @@ export const EvidenceParams = { } return message; }, - - toJSON(message: EvidenceParams): unknown { - const obj: any = {}; - message.maxAgeNumBlocks !== undefined && - (obj.maxAgeNumBlocks = (message.maxAgeNumBlocks || Long.ZERO).toString()); - message.maxAgeDuration !== undefined && - (obj.maxAgeDuration = message.maxAgeDuration ? Duration.toJSON(message.maxAgeDuration) : undefined); - message.maxBytes !== undefined && (obj.maxBytes = (message.maxBytes || Long.ZERO).toString()); - return obj; - }, }; const baseValidatorParams: object = { pubKeyTypes: "" }; @@ -378,7 +388,7 @@ export const ValidatorParams = { decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorParams { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseValidatorParams) as ValidatorParams; + const message = { ...baseValidatorParams } as ValidatorParams; message.pubKeyTypes = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -395,22 +405,11 @@ export const ValidatorParams = { }, fromJSON(object: any): ValidatorParams { - const message = Object.create(baseValidatorParams) as ValidatorParams; - message.pubKeyTypes = []; - if (object.pubKeyTypes !== undefined && object.pubKeyTypes !== null) { - for (const e of object.pubKeyTypes) { - message.pubKeyTypes.push(String(e)); - } - } - return message; - }, - - fromPartial(object: DeepPartial): ValidatorParams { const message = { ...baseValidatorParams } as ValidatorParams; message.pubKeyTypes = []; if (object.pubKeyTypes !== undefined && object.pubKeyTypes !== null) { for (const e of object.pubKeyTypes) { - message.pubKeyTypes.push(e); + message.pubKeyTypes.push(String(e)); } } return message; @@ -425,20 +424,33 @@ export const ValidatorParams = { } return obj; }, + + fromPartial(object: DeepPartial): ValidatorParams { + const message = { ...baseValidatorParams } as ValidatorParams; + message.pubKeyTypes = []; + if (object.pubKeyTypes !== undefined && object.pubKeyTypes !== null) { + for (const e of object.pubKeyTypes) { + message.pubKeyTypes.push(e); + } + } + return message; + }, }; const baseVersionParams: object = { appVersion: Long.UZERO }; export const VersionParams = { encode(message: VersionParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).uint64(message.appVersion); + if (!message.appVersion.isZero()) { + writer.uint32(8).uint64(message.appVersion); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): VersionParams { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseVersionParams) as VersionParams; + const message = { ...baseVersionParams } as VersionParams; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -454,19 +466,9 @@ export const VersionParams = { }, fromJSON(object: any): VersionParams { - const message = Object.create(baseVersionParams) as VersionParams; - if (object.appVersion !== undefined && object.appVersion !== null) { - message.appVersion = Long.fromString(object.appVersion); - } else { - message.appVersion = Long.UZERO; - } - return message; - }, - - fromPartial(object: DeepPartial): VersionParams { const message = { ...baseVersionParams } as VersionParams; if (object.appVersion !== undefined && object.appVersion !== null) { - message.appVersion = object.appVersion as Long; + message.appVersion = Long.fromString(object.appVersion); } else { message.appVersion = Long.UZERO; } @@ -478,21 +480,35 @@ export const VersionParams = { message.appVersion !== undefined && (obj.appVersion = (message.appVersion || Long.UZERO).toString()); return obj; }, + + fromPartial(object: DeepPartial): VersionParams { + const message = { ...baseVersionParams } as VersionParams; + if (object.appVersion !== undefined && object.appVersion !== null) { + message.appVersion = object.appVersion as Long; + } else { + message.appVersion = Long.UZERO; + } + return message; + }, }; const baseHashedParams: object = { blockMaxBytes: Long.ZERO, blockMaxGas: Long.ZERO }; export const HashedParams = { encode(message: HashedParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).int64(message.blockMaxBytes); - writer.uint32(16).int64(message.blockMaxGas); + if (!message.blockMaxBytes.isZero()) { + writer.uint32(8).int64(message.blockMaxBytes); + } + if (!message.blockMaxGas.isZero()) { + writer.uint32(16).int64(message.blockMaxGas); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): HashedParams { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseHashedParams) as HashedParams; + const message = { ...baseHashedParams } as HashedParams; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -511,7 +527,7 @@ export const HashedParams = { }, fromJSON(object: any): HashedParams { - const message = Object.create(baseHashedParams) as HashedParams; + const message = { ...baseHashedParams } as HashedParams; if (object.blockMaxBytes !== undefined && object.blockMaxBytes !== null) { message.blockMaxBytes = Long.fromString(object.blockMaxBytes); } else { @@ -525,6 +541,14 @@ export const HashedParams = { return message; }, + toJSON(message: HashedParams): unknown { + const obj: any = {}; + message.blockMaxBytes !== undefined && + (obj.blockMaxBytes = (message.blockMaxBytes || Long.ZERO).toString()); + message.blockMaxGas !== undefined && (obj.blockMaxGas = (message.blockMaxGas || Long.ZERO).toString()); + return obj; + }, + fromPartial(object: DeepPartial): HashedParams { const message = { ...baseHashedParams } as HashedParams; if (object.blockMaxBytes !== undefined && object.blockMaxBytes !== null) { @@ -539,14 +563,6 @@ export const HashedParams = { } return message; }, - - toJSON(message: HashedParams): unknown { - const obj: any = {}; - message.blockMaxBytes !== undefined && - (obj.blockMaxBytes = (message.blockMaxBytes || Long.ZERO).toString()); - message.blockMaxGas !== undefined && (obj.blockMaxGas = (message.blockMaxGas || Long.ZERO).toString()); - return obj; - }, }; type Builtin = Date | Function | Uint8Array | string | number | undefined | Long; diff --git a/packages/stargate/src/codec/tendermint/types/types.ts b/packages/stargate/src/codec/tendermint/types/types.ts index aadbe0fe..fa2ff7b2 100644 --- a/packages/stargate/src/codec/tendermint/types/types.ts +++ b/packages/stargate/src/codec/tendermint/types/types.ts @@ -227,15 +227,19 @@ const basePartSetHeader: object = { total: 0 }; export const PartSetHeader = { encode(message: PartSetHeader, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).uint32(message.total); - writer.uint32(18).bytes(message.hash); + if (message.total !== 0) { + writer.uint32(8).uint32(message.total); + } + if (message.hash.length !== 0) { + writer.uint32(18).bytes(message.hash); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): PartSetHeader { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(basePartSetHeader) as PartSetHeader; + const message = { ...basePartSetHeader } as PartSetHeader; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -254,7 +258,7 @@ export const PartSetHeader = { }, fromJSON(object: any): PartSetHeader { - const message = Object.create(basePartSetHeader) as PartSetHeader; + const message = { ...basePartSetHeader } as PartSetHeader; if (object.total !== undefined && object.total !== null) { message.total = Number(object.total); } else { @@ -266,6 +270,14 @@ export const PartSetHeader = { return message; }, + toJSON(message: PartSetHeader): unknown { + const obj: any = {}; + message.total !== undefined && (obj.total = message.total); + message.hash !== undefined && + (obj.hash = base64FromBytes(message.hash !== undefined ? message.hash : new Uint8Array())); + return obj; + }, + fromPartial(object: DeepPartial): PartSetHeader { const message = { ...basePartSetHeader } as PartSetHeader; if (object.total !== undefined && object.total !== null) { @@ -280,22 +292,18 @@ export const PartSetHeader = { } return message; }, - - toJSON(message: PartSetHeader): unknown { - const obj: any = {}; - message.total !== undefined && (obj.total = message.total); - message.hash !== undefined && - (obj.hash = base64FromBytes(message.hash !== undefined ? message.hash : new Uint8Array())); - return obj; - }, }; const basePart: object = { index: 0 }; export const Part = { encode(message: Part, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).uint32(message.index); - writer.uint32(18).bytes(message.bytes); + if (message.index !== 0) { + writer.uint32(8).uint32(message.index); + } + if (message.bytes.length !== 0) { + writer.uint32(18).bytes(message.bytes); + } if (message.proof !== undefined) { Proof.encode(message.proof, writer.uint32(26).fork()).ldelim(); } @@ -305,7 +313,7 @@ export const Part = { decode(input: _m0.Reader | Uint8Array, length?: number): Part { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(basePart) as Part; + const message = { ...basePart } as Part; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -327,7 +335,7 @@ export const Part = { }, fromJSON(object: any): Part { - const message = Object.create(basePart) as Part; + const message = { ...basePart } as Part; if (object.index !== undefined && object.index !== null) { message.index = Number(object.index); } else { @@ -344,6 +352,15 @@ export const Part = { return message; }, + toJSON(message: Part): unknown { + const obj: any = {}; + message.index !== undefined && (obj.index = message.index); + message.bytes !== undefined && + (obj.bytes = base64FromBytes(message.bytes !== undefined ? message.bytes : new Uint8Array())); + message.proof !== undefined && (obj.proof = message.proof ? Proof.toJSON(message.proof) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): Part { const message = { ...basePart } as Part; if (object.index !== undefined && object.index !== null) { @@ -363,22 +380,15 @@ export const Part = { } return message; }, - - toJSON(message: Part): unknown { - const obj: any = {}; - message.index !== undefined && (obj.index = message.index); - message.bytes !== undefined && - (obj.bytes = base64FromBytes(message.bytes !== undefined ? message.bytes : new Uint8Array())); - message.proof !== undefined && (obj.proof = message.proof ? Proof.toJSON(message.proof) : undefined); - return obj; - }, }; const baseBlockID: object = {}; export const BlockID = { encode(message: BlockID, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).bytes(message.hash); + if (message.hash.length !== 0) { + writer.uint32(10).bytes(message.hash); + } if (message.partSetHeader !== undefined) { PartSetHeader.encode(message.partSetHeader, writer.uint32(18).fork()).ldelim(); } @@ -388,7 +398,7 @@ export const BlockID = { decode(input: _m0.Reader | Uint8Array, length?: number): BlockID { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseBlockID) as BlockID; + const message = { ...baseBlockID } as BlockID; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -407,7 +417,7 @@ export const BlockID = { }, fromJSON(object: any): BlockID { - const message = Object.create(baseBlockID) as BlockID; + const message = { ...baseBlockID } as BlockID; if (object.hash !== undefined && object.hash !== null) { message.hash = bytesFromBase64(object.hash); } @@ -419,6 +429,15 @@ export const BlockID = { return message; }, + toJSON(message: BlockID): unknown { + const obj: any = {}; + message.hash !== undefined && + (obj.hash = base64FromBytes(message.hash !== undefined ? message.hash : new Uint8Array())); + message.partSetHeader !== undefined && + (obj.partSetHeader = message.partSetHeader ? PartSetHeader.toJSON(message.partSetHeader) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): BlockID { const message = { ...baseBlockID } as BlockID; if (object.hash !== undefined && object.hash !== null) { @@ -433,15 +452,6 @@ export const BlockID = { } return message; }, - - toJSON(message: BlockID): unknown { - const obj: any = {}; - message.hash !== undefined && - (obj.hash = base64FromBytes(message.hash !== undefined ? message.hash : new Uint8Array())); - message.partSetHeader !== undefined && - (obj.partSetHeader = message.partSetHeader ? PartSetHeader.toJSON(message.partSetHeader) : undefined); - return obj; - }, }; const baseHeader: object = { chainId: "", height: Long.ZERO }; @@ -451,30 +461,52 @@ export const Header = { if (message.version !== undefined) { Consensus.encode(message.version, writer.uint32(10).fork()).ldelim(); } - writer.uint32(18).string(message.chainId); - writer.uint32(24).int64(message.height); + if (message.chainId !== "") { + writer.uint32(18).string(message.chainId); + } + if (!message.height.isZero()) { + writer.uint32(24).int64(message.height); + } if (message.time !== undefined) { Timestamp.encode(toTimestamp(message.time), writer.uint32(34).fork()).ldelim(); } if (message.lastBlockId !== undefined) { BlockID.encode(message.lastBlockId, writer.uint32(42).fork()).ldelim(); } - writer.uint32(50).bytes(message.lastCommitHash); - writer.uint32(58).bytes(message.dataHash); - writer.uint32(66).bytes(message.validatorsHash); - writer.uint32(74).bytes(message.nextValidatorsHash); - writer.uint32(82).bytes(message.consensusHash); - writer.uint32(90).bytes(message.appHash); - writer.uint32(98).bytes(message.lastResultsHash); - writer.uint32(106).bytes(message.evidenceHash); - writer.uint32(114).bytes(message.proposerAddress); + if (message.lastCommitHash.length !== 0) { + writer.uint32(50).bytes(message.lastCommitHash); + } + if (message.dataHash.length !== 0) { + writer.uint32(58).bytes(message.dataHash); + } + if (message.validatorsHash.length !== 0) { + writer.uint32(66).bytes(message.validatorsHash); + } + if (message.nextValidatorsHash.length !== 0) { + writer.uint32(74).bytes(message.nextValidatorsHash); + } + if (message.consensusHash.length !== 0) { + writer.uint32(82).bytes(message.consensusHash); + } + if (message.appHash.length !== 0) { + writer.uint32(90).bytes(message.appHash); + } + if (message.lastResultsHash.length !== 0) { + writer.uint32(98).bytes(message.lastResultsHash); + } + if (message.evidenceHash.length !== 0) { + writer.uint32(106).bytes(message.evidenceHash); + } + if (message.proposerAddress.length !== 0) { + writer.uint32(114).bytes(message.proposerAddress); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): Header { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseHeader) as Header; + const message = { ...baseHeader } as Header; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -529,7 +561,7 @@ export const Header = { }, fromJSON(object: any): Header { - const message = Object.create(baseHeader) as Header; + const message = { ...baseHeader } as Header; if (object.version !== undefined && object.version !== null) { message.version = Consensus.fromJSON(object.version); } else { @@ -585,6 +617,50 @@ export const Header = { return message; }, + toJSON(message: Header): unknown { + const obj: any = {}; + message.version !== undefined && + (obj.version = message.version ? Consensus.toJSON(message.version) : undefined); + message.chainId !== undefined && (obj.chainId = message.chainId); + message.height !== undefined && (obj.height = (message.height || Long.ZERO).toString()); + message.time !== undefined && (obj.time = message.time !== undefined ? message.time.toISOString() : null); + message.lastBlockId !== undefined && + (obj.lastBlockId = message.lastBlockId ? BlockID.toJSON(message.lastBlockId) : undefined); + message.lastCommitHash !== undefined && + (obj.lastCommitHash = base64FromBytes( + message.lastCommitHash !== undefined ? message.lastCommitHash : new Uint8Array(), + )); + message.dataHash !== undefined && + (obj.dataHash = base64FromBytes(message.dataHash !== undefined ? message.dataHash : new Uint8Array())); + message.validatorsHash !== undefined && + (obj.validatorsHash = base64FromBytes( + message.validatorsHash !== undefined ? message.validatorsHash : new Uint8Array(), + )); + message.nextValidatorsHash !== undefined && + (obj.nextValidatorsHash = base64FromBytes( + message.nextValidatorsHash !== undefined ? message.nextValidatorsHash : new Uint8Array(), + )); + message.consensusHash !== undefined && + (obj.consensusHash = base64FromBytes( + message.consensusHash !== undefined ? message.consensusHash : new Uint8Array(), + )); + message.appHash !== undefined && + (obj.appHash = base64FromBytes(message.appHash !== undefined ? message.appHash : new Uint8Array())); + message.lastResultsHash !== undefined && + (obj.lastResultsHash = base64FromBytes( + message.lastResultsHash !== undefined ? message.lastResultsHash : new Uint8Array(), + )); + message.evidenceHash !== undefined && + (obj.evidenceHash = base64FromBytes( + message.evidenceHash !== undefined ? message.evidenceHash : new Uint8Array(), + )); + message.proposerAddress !== undefined && + (obj.proposerAddress = base64FromBytes( + message.proposerAddress !== undefined ? message.proposerAddress : new Uint8Array(), + )); + return obj; + }, + fromPartial(object: DeepPartial
): Header { const message = { ...baseHeader } as Header; if (object.version !== undefined && object.version !== null) { @@ -659,50 +735,6 @@ export const Header = { } return message; }, - - toJSON(message: Header): unknown { - const obj: any = {}; - message.version !== undefined && - (obj.version = message.version ? Consensus.toJSON(message.version) : undefined); - message.chainId !== undefined && (obj.chainId = message.chainId); - message.height !== undefined && (obj.height = (message.height || Long.ZERO).toString()); - message.time !== undefined && (obj.time = message.time !== undefined ? message.time.toISOString() : null); - message.lastBlockId !== undefined && - (obj.lastBlockId = message.lastBlockId ? BlockID.toJSON(message.lastBlockId) : undefined); - message.lastCommitHash !== undefined && - (obj.lastCommitHash = base64FromBytes( - message.lastCommitHash !== undefined ? message.lastCommitHash : new Uint8Array(), - )); - message.dataHash !== undefined && - (obj.dataHash = base64FromBytes(message.dataHash !== undefined ? message.dataHash : new Uint8Array())); - message.validatorsHash !== undefined && - (obj.validatorsHash = base64FromBytes( - message.validatorsHash !== undefined ? message.validatorsHash : new Uint8Array(), - )); - message.nextValidatorsHash !== undefined && - (obj.nextValidatorsHash = base64FromBytes( - message.nextValidatorsHash !== undefined ? message.nextValidatorsHash : new Uint8Array(), - )); - message.consensusHash !== undefined && - (obj.consensusHash = base64FromBytes( - message.consensusHash !== undefined ? message.consensusHash : new Uint8Array(), - )); - message.appHash !== undefined && - (obj.appHash = base64FromBytes(message.appHash !== undefined ? message.appHash : new Uint8Array())); - message.lastResultsHash !== undefined && - (obj.lastResultsHash = base64FromBytes( - message.lastResultsHash !== undefined ? message.lastResultsHash : new Uint8Array(), - )); - message.evidenceHash !== undefined && - (obj.evidenceHash = base64FromBytes( - message.evidenceHash !== undefined ? message.evidenceHash : new Uint8Array(), - )); - message.proposerAddress !== undefined && - (obj.proposerAddress = base64FromBytes( - message.proposerAddress !== undefined ? message.proposerAddress : new Uint8Array(), - )); - return obj; - }, }; const baseData: object = {}; @@ -718,7 +750,7 @@ export const Data = { decode(input: _m0.Reader | Uint8Array, length?: number): Data { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseData) as Data; + const message = { ...baseData } as Data; message.txs = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -735,22 +767,11 @@ export const Data = { }, fromJSON(object: any): Data { - const message = Object.create(baseData) as Data; - message.txs = []; - if (object.txs !== undefined && object.txs !== null) { - for (const e of object.txs) { - message.txs.push(bytesFromBase64(e)); - } - } - return message; - }, - - fromPartial(object: DeepPartial): Data { const message = { ...baseData } as Data; message.txs = []; if (object.txs !== undefined && object.txs !== null) { for (const e of object.txs) { - message.txs.push(e); + message.txs.push(bytesFromBase64(e)); } } return message; @@ -765,31 +786,54 @@ export const Data = { } return obj; }, + + fromPartial(object: DeepPartial): Data { + const message = { ...baseData } as Data; + message.txs = []; + if (object.txs !== undefined && object.txs !== null) { + for (const e of object.txs) { + message.txs.push(e); + } + } + return message; + }, }; const baseVote: object = { type: 0, height: Long.ZERO, round: 0, validatorIndex: 0 }; export const Vote = { encode(message: Vote, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).int32(message.type); - writer.uint32(16).int64(message.height); - writer.uint32(24).int32(message.round); + if (message.type !== 0) { + writer.uint32(8).int32(message.type); + } + if (!message.height.isZero()) { + writer.uint32(16).int64(message.height); + } + if (message.round !== 0) { + writer.uint32(24).int32(message.round); + } if (message.blockId !== undefined) { BlockID.encode(message.blockId, writer.uint32(34).fork()).ldelim(); } if (message.timestamp !== undefined) { Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(42).fork()).ldelim(); } - writer.uint32(50).bytes(message.validatorAddress); - writer.uint32(56).int32(message.validatorIndex); - writer.uint32(66).bytes(message.signature); + if (message.validatorAddress.length !== 0) { + writer.uint32(50).bytes(message.validatorAddress); + } + if (message.validatorIndex !== 0) { + writer.uint32(56).int32(message.validatorIndex); + } + if (message.signature.length !== 0) { + writer.uint32(66).bytes(message.signature); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): Vote { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseVote) as Vote; + const message = { ...baseVote } as Vote; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -826,7 +870,7 @@ export const Vote = { }, fromJSON(object: any): Vote { - const message = Object.create(baseVote) as Vote; + const message = { ...baseVote } as Vote; if (object.type !== undefined && object.type !== null) { message.type = signedMsgTypeFromJSON(object.type); } else { @@ -866,6 +910,27 @@ export const Vote = { return message; }, + toJSON(message: Vote): unknown { + const obj: any = {}; + message.type !== undefined && (obj.type = signedMsgTypeToJSON(message.type)); + message.height !== undefined && (obj.height = (message.height || Long.ZERO).toString()); + message.round !== undefined && (obj.round = message.round); + message.blockId !== undefined && + (obj.blockId = message.blockId ? BlockID.toJSON(message.blockId) : undefined); + message.timestamp !== undefined && + (obj.timestamp = message.timestamp !== undefined ? message.timestamp.toISOString() : null); + message.validatorAddress !== undefined && + (obj.validatorAddress = base64FromBytes( + message.validatorAddress !== undefined ? message.validatorAddress : new Uint8Array(), + )); + message.validatorIndex !== undefined && (obj.validatorIndex = message.validatorIndex); + message.signature !== undefined && + (obj.signature = base64FromBytes( + message.signature !== undefined ? message.signature : new Uint8Array(), + )); + return obj; + }, + fromPartial(object: DeepPartial): Vote { const message = { ...baseVote } as Vote; if (object.type !== undefined && object.type !== null) { @@ -910,35 +975,18 @@ export const Vote = { } return message; }, - - toJSON(message: Vote): unknown { - const obj: any = {}; - message.type !== undefined && (obj.type = signedMsgTypeToJSON(message.type)); - message.height !== undefined && (obj.height = (message.height || Long.ZERO).toString()); - message.round !== undefined && (obj.round = message.round); - message.blockId !== undefined && - (obj.blockId = message.blockId ? BlockID.toJSON(message.blockId) : undefined); - message.timestamp !== undefined && - (obj.timestamp = message.timestamp !== undefined ? message.timestamp.toISOString() : null); - message.validatorAddress !== undefined && - (obj.validatorAddress = base64FromBytes( - message.validatorAddress !== undefined ? message.validatorAddress : new Uint8Array(), - )); - message.validatorIndex !== undefined && (obj.validatorIndex = message.validatorIndex); - message.signature !== undefined && - (obj.signature = base64FromBytes( - message.signature !== undefined ? message.signature : new Uint8Array(), - )); - return obj; - }, }; const baseCommit: object = { height: Long.ZERO, round: 0 }; export const Commit = { encode(message: Commit, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).int64(message.height); - writer.uint32(16).int32(message.round); + if (!message.height.isZero()) { + writer.uint32(8).int64(message.height); + } + if (message.round !== 0) { + writer.uint32(16).int32(message.round); + } if (message.blockId !== undefined) { BlockID.encode(message.blockId, writer.uint32(26).fork()).ldelim(); } @@ -951,7 +999,7 @@ export const Commit = { decode(input: _m0.Reader | Uint8Array, length?: number): Commit { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseCommit) as Commit; + const message = { ...baseCommit } as Commit; message.signatures = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -977,7 +1025,7 @@ export const Commit = { }, fromJSON(object: any): Commit { - const message = Object.create(baseCommit) as Commit; + const message = { ...baseCommit } as Commit; message.signatures = []; if (object.height !== undefined && object.height !== null) { message.height = Long.fromString(object.height); @@ -1002,6 +1050,20 @@ export const Commit = { return message; }, + toJSON(message: Commit): unknown { + const obj: any = {}; + message.height !== undefined && (obj.height = (message.height || Long.ZERO).toString()); + message.round !== undefined && (obj.round = message.round); + message.blockId !== undefined && + (obj.blockId = message.blockId ? BlockID.toJSON(message.blockId) : undefined); + if (message.signatures) { + obj.signatures = message.signatures.map((e) => (e ? CommitSig.toJSON(e) : undefined)); + } else { + obj.signatures = []; + } + return obj; + }, + fromPartial(object: DeepPartial): Commit { const message = { ...baseCommit } as Commit; message.signatures = []; @@ -1027,39 +1089,31 @@ export const Commit = { } return message; }, - - toJSON(message: Commit): unknown { - const obj: any = {}; - message.height !== undefined && (obj.height = (message.height || Long.ZERO).toString()); - message.round !== undefined && (obj.round = message.round); - message.blockId !== undefined && - (obj.blockId = message.blockId ? BlockID.toJSON(message.blockId) : undefined); - if (message.signatures) { - obj.signatures = message.signatures.map((e) => (e ? CommitSig.toJSON(e) : undefined)); - } else { - obj.signatures = []; - } - return obj; - }, }; const baseCommitSig: object = { blockIdFlag: 0 }; export const CommitSig = { encode(message: CommitSig, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).int32(message.blockIdFlag); - writer.uint32(18).bytes(message.validatorAddress); + if (message.blockIdFlag !== 0) { + writer.uint32(8).int32(message.blockIdFlag); + } + if (message.validatorAddress.length !== 0) { + writer.uint32(18).bytes(message.validatorAddress); + } if (message.timestamp !== undefined) { Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(26).fork()).ldelim(); } - writer.uint32(34).bytes(message.signature); + if (message.signature.length !== 0) { + writer.uint32(34).bytes(message.signature); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): CommitSig { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseCommitSig) as CommitSig; + const message = { ...baseCommitSig } as CommitSig; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1084,7 +1138,7 @@ export const CommitSig = { }, fromJSON(object: any): CommitSig { - const message = Object.create(baseCommitSig) as CommitSig; + const message = { ...baseCommitSig } as CommitSig; if (object.blockIdFlag !== undefined && object.blockIdFlag !== null) { message.blockIdFlag = blockIDFlagFromJSON(object.blockIdFlag); } else { @@ -1104,6 +1158,22 @@ export const CommitSig = { return message; }, + toJSON(message: CommitSig): unknown { + const obj: any = {}; + message.blockIdFlag !== undefined && (obj.blockIdFlag = blockIDFlagToJSON(message.blockIdFlag)); + message.validatorAddress !== undefined && + (obj.validatorAddress = base64FromBytes( + message.validatorAddress !== undefined ? message.validatorAddress : new Uint8Array(), + )); + message.timestamp !== undefined && + (obj.timestamp = message.timestamp !== undefined ? message.timestamp.toISOString() : null); + message.signature !== undefined && + (obj.signature = base64FromBytes( + message.signature !== undefined ? message.signature : new Uint8Array(), + )); + return obj; + }, + fromPartial(object: DeepPartial): CommitSig { const message = { ...baseCommitSig } as CommitSig; if (object.blockIdFlag !== undefined && object.blockIdFlag !== null) { @@ -1128,46 +1198,40 @@ export const CommitSig = { } return message; }, - - toJSON(message: CommitSig): unknown { - const obj: any = {}; - message.blockIdFlag !== undefined && (obj.blockIdFlag = blockIDFlagToJSON(message.blockIdFlag)); - message.validatorAddress !== undefined && - (obj.validatorAddress = base64FromBytes( - message.validatorAddress !== undefined ? message.validatorAddress : new Uint8Array(), - )); - message.timestamp !== undefined && - (obj.timestamp = message.timestamp !== undefined ? message.timestamp.toISOString() : null); - message.signature !== undefined && - (obj.signature = base64FromBytes( - message.signature !== undefined ? message.signature : new Uint8Array(), - )); - return obj; - }, }; const baseProposal: object = { type: 0, height: Long.ZERO, round: 0, polRound: 0 }; export const Proposal = { encode(message: Proposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).int32(message.type); - writer.uint32(16).int64(message.height); - writer.uint32(24).int32(message.round); - writer.uint32(32).int32(message.polRound); + if (message.type !== 0) { + writer.uint32(8).int32(message.type); + } + if (!message.height.isZero()) { + writer.uint32(16).int64(message.height); + } + if (message.round !== 0) { + writer.uint32(24).int32(message.round); + } + if (message.polRound !== 0) { + writer.uint32(32).int32(message.polRound); + } if (message.blockId !== undefined) { BlockID.encode(message.blockId, writer.uint32(42).fork()).ldelim(); } if (message.timestamp !== undefined) { Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(50).fork()).ldelim(); } - writer.uint32(58).bytes(message.signature); + if (message.signature.length !== 0) { + writer.uint32(58).bytes(message.signature); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): Proposal { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseProposal) as Proposal; + const message = { ...baseProposal } as Proposal; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1201,7 +1265,7 @@ export const Proposal = { }, fromJSON(object: any): Proposal { - const message = Object.create(baseProposal) as Proposal; + const message = { ...baseProposal } as Proposal; if (object.type !== undefined && object.type !== null) { message.type = signedMsgTypeFromJSON(object.type); } else { @@ -1238,6 +1302,23 @@ export const Proposal = { return message; }, + toJSON(message: Proposal): unknown { + const obj: any = {}; + message.type !== undefined && (obj.type = signedMsgTypeToJSON(message.type)); + message.height !== undefined && (obj.height = (message.height || Long.ZERO).toString()); + message.round !== undefined && (obj.round = message.round); + message.polRound !== undefined && (obj.polRound = message.polRound); + message.blockId !== undefined && + (obj.blockId = message.blockId ? BlockID.toJSON(message.blockId) : undefined); + message.timestamp !== undefined && + (obj.timestamp = message.timestamp !== undefined ? message.timestamp.toISOString() : null); + message.signature !== undefined && + (obj.signature = base64FromBytes( + message.signature !== undefined ? message.signature : new Uint8Array(), + )); + return obj; + }, + fromPartial(object: DeepPartial): Proposal { const message = { ...baseProposal } as Proposal; if (object.type !== undefined && object.type !== null) { @@ -1277,23 +1358,6 @@ export const Proposal = { } return message; }, - - toJSON(message: Proposal): unknown { - const obj: any = {}; - message.type !== undefined && (obj.type = signedMsgTypeToJSON(message.type)); - message.height !== undefined && (obj.height = (message.height || Long.ZERO).toString()); - message.round !== undefined && (obj.round = message.round); - message.polRound !== undefined && (obj.polRound = message.polRound); - message.blockId !== undefined && - (obj.blockId = message.blockId ? BlockID.toJSON(message.blockId) : undefined); - message.timestamp !== undefined && - (obj.timestamp = message.timestamp !== undefined ? message.timestamp.toISOString() : null); - message.signature !== undefined && - (obj.signature = base64FromBytes( - message.signature !== undefined ? message.signature : new Uint8Array(), - )); - return obj; - }, }; const baseSignedHeader: object = {}; @@ -1312,7 +1376,7 @@ export const SignedHeader = { decode(input: _m0.Reader | Uint8Array, length?: number): SignedHeader { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseSignedHeader) as SignedHeader; + const message = { ...baseSignedHeader } as SignedHeader; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1331,7 +1395,7 @@ export const SignedHeader = { }, fromJSON(object: any): SignedHeader { - const message = Object.create(baseSignedHeader) as SignedHeader; + const message = { ...baseSignedHeader } as SignedHeader; if (object.header !== undefined && object.header !== null) { message.header = Header.fromJSON(object.header); } else { @@ -1345,6 +1409,13 @@ export const SignedHeader = { return message; }, + toJSON(message: SignedHeader): unknown { + const obj: any = {}; + message.header !== undefined && (obj.header = message.header ? Header.toJSON(message.header) : undefined); + message.commit !== undefined && (obj.commit = message.commit ? Commit.toJSON(message.commit) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): SignedHeader { const message = { ...baseSignedHeader } as SignedHeader; if (object.header !== undefined && object.header !== null) { @@ -1359,13 +1430,6 @@ export const SignedHeader = { } return message; }, - - toJSON(message: SignedHeader): unknown { - const obj: any = {}; - message.header !== undefined && (obj.header = message.header ? Header.toJSON(message.header) : undefined); - message.commit !== undefined && (obj.commit = message.commit ? Commit.toJSON(message.commit) : undefined); - return obj; - }, }; const baseLightBlock: object = {}; @@ -1384,7 +1448,7 @@ export const LightBlock = { decode(input: _m0.Reader | Uint8Array, length?: number): LightBlock { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseLightBlock) as LightBlock; + const message = { ...baseLightBlock } as LightBlock; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1403,7 +1467,7 @@ export const LightBlock = { }, fromJSON(object: any): LightBlock { - const message = Object.create(baseLightBlock) as LightBlock; + const message = { ...baseLightBlock } as LightBlock; if (object.signedHeader !== undefined && object.signedHeader !== null) { message.signedHeader = SignedHeader.fromJSON(object.signedHeader); } else { @@ -1417,6 +1481,15 @@ export const LightBlock = { return message; }, + toJSON(message: LightBlock): unknown { + const obj: any = {}; + message.signedHeader !== undefined && + (obj.signedHeader = message.signedHeader ? SignedHeader.toJSON(message.signedHeader) : undefined); + message.validatorSet !== undefined && + (obj.validatorSet = message.validatorSet ? ValidatorSet.toJSON(message.validatorSet) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): LightBlock { const message = { ...baseLightBlock } as LightBlock; if (object.signedHeader !== undefined && object.signedHeader !== null) { @@ -1431,15 +1504,6 @@ export const LightBlock = { } return message; }, - - toJSON(message: LightBlock): unknown { - const obj: any = {}; - message.signedHeader !== undefined && - (obj.signedHeader = message.signedHeader ? SignedHeader.toJSON(message.signedHeader) : undefined); - message.validatorSet !== undefined && - (obj.validatorSet = message.validatorSet ? ValidatorSet.toJSON(message.validatorSet) : undefined); - return obj; - }, }; const baseBlockMeta: object = { blockSize: Long.ZERO, numTxs: Long.ZERO }; @@ -1449,18 +1513,22 @@ export const BlockMeta = { if (message.blockId !== undefined) { BlockID.encode(message.blockId, writer.uint32(10).fork()).ldelim(); } - writer.uint32(16).int64(message.blockSize); + if (!message.blockSize.isZero()) { + writer.uint32(16).int64(message.blockSize); + } if (message.header !== undefined) { Header.encode(message.header, writer.uint32(26).fork()).ldelim(); } - writer.uint32(32).int64(message.numTxs); + if (!message.numTxs.isZero()) { + writer.uint32(32).int64(message.numTxs); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): BlockMeta { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseBlockMeta) as BlockMeta; + const message = { ...baseBlockMeta } as BlockMeta; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1485,7 +1553,7 @@ export const BlockMeta = { }, fromJSON(object: any): BlockMeta { - const message = Object.create(baseBlockMeta) as BlockMeta; + const message = { ...baseBlockMeta } as BlockMeta; if (object.blockId !== undefined && object.blockId !== null) { message.blockId = BlockID.fromJSON(object.blockId); } else { @@ -1509,6 +1577,16 @@ export const BlockMeta = { return message; }, + toJSON(message: BlockMeta): unknown { + const obj: any = {}; + message.blockId !== undefined && + (obj.blockId = message.blockId ? BlockID.toJSON(message.blockId) : undefined); + message.blockSize !== undefined && (obj.blockSize = (message.blockSize || Long.ZERO).toString()); + message.header !== undefined && (obj.header = message.header ? Header.toJSON(message.header) : undefined); + message.numTxs !== undefined && (obj.numTxs = (message.numTxs || Long.ZERO).toString()); + return obj; + }, + fromPartial(object: DeepPartial): BlockMeta { const message = { ...baseBlockMeta } as BlockMeta; if (object.blockId !== undefined && object.blockId !== null) { @@ -1533,24 +1611,18 @@ export const BlockMeta = { } return message; }, - - toJSON(message: BlockMeta): unknown { - const obj: any = {}; - message.blockId !== undefined && - (obj.blockId = message.blockId ? BlockID.toJSON(message.blockId) : undefined); - message.blockSize !== undefined && (obj.blockSize = (message.blockSize || Long.ZERO).toString()); - message.header !== undefined && (obj.header = message.header ? Header.toJSON(message.header) : undefined); - message.numTxs !== undefined && (obj.numTxs = (message.numTxs || Long.ZERO).toString()); - return obj; - }, }; const baseTxProof: object = {}; export const TxProof = { encode(message: TxProof, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).bytes(message.rootHash); - writer.uint32(18).bytes(message.data); + if (message.rootHash.length !== 0) { + writer.uint32(10).bytes(message.rootHash); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } if (message.proof !== undefined) { Proof.encode(message.proof, writer.uint32(26).fork()).ldelim(); } @@ -1560,7 +1632,7 @@ export const TxProof = { decode(input: _m0.Reader | Uint8Array, length?: number): TxProof { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseTxProof) as TxProof; + const message = { ...baseTxProof } as TxProof; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -1582,7 +1654,7 @@ export const TxProof = { }, fromJSON(object: any): TxProof { - const message = Object.create(baseTxProof) as TxProof; + const message = { ...baseTxProof } as TxProof; if (object.rootHash !== undefined && object.rootHash !== null) { message.rootHash = bytesFromBase64(object.rootHash); } @@ -1597,6 +1669,16 @@ export const TxProof = { return message; }, + toJSON(message: TxProof): unknown { + const obj: any = {}; + message.rootHash !== undefined && + (obj.rootHash = base64FromBytes(message.rootHash !== undefined ? message.rootHash : new Uint8Array())); + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); + message.proof !== undefined && (obj.proof = message.proof ? Proof.toJSON(message.proof) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): TxProof { const message = { ...baseTxProof } as TxProof; if (object.rootHash !== undefined && object.rootHash !== null) { @@ -1616,16 +1698,6 @@ export const TxProof = { } return message; }, - - toJSON(message: TxProof): unknown { - const obj: any = {}; - message.rootHash !== undefined && - (obj.rootHash = base64FromBytes(message.rootHash !== undefined ? message.rootHash : new Uint8Array())); - message.data !== undefined && - (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); - message.proof !== undefined && (obj.proof = message.proof ? Proof.toJSON(message.proof) : undefined); - return obj; - }, }; declare var self: any | undefined; @@ -1635,7 +1707,7 @@ var globalThis: any = (() => { if (typeof self !== "undefined") return self; if (typeof window !== "undefined") return window; if (typeof global !== "undefined") return global; - throw new Error("Unable to locate global object"); + throw "Unable to locate global object"; })(); const atob: (b64: string) => string = diff --git a/packages/stargate/src/codec/tendermint/types/validator.ts b/packages/stargate/src/codec/tendermint/types/validator.ts index 9fb71308..be7652cb 100644 --- a/packages/stargate/src/codec/tendermint/types/validator.ts +++ b/packages/stargate/src/codec/tendermint/types/validator.ts @@ -33,14 +33,16 @@ export const ValidatorSet = { if (message.proposer !== undefined) { Validator.encode(message.proposer, writer.uint32(18).fork()).ldelim(); } - writer.uint32(24).int64(message.totalVotingPower); + if (!message.totalVotingPower.isZero()) { + writer.uint32(24).int64(message.totalVotingPower); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): ValidatorSet { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseValidatorSet) as ValidatorSet; + const message = { ...baseValidatorSet } as ValidatorSet; message.validators = []; while (reader.pos < end) { const tag = reader.uint32(); @@ -63,7 +65,7 @@ export const ValidatorSet = { }, fromJSON(object: any): ValidatorSet { - const message = Object.create(baseValidatorSet) as ValidatorSet; + const message = { ...baseValidatorSet } as ValidatorSet; message.validators = []; if (object.validators !== undefined && object.validators !== null) { for (const e of object.validators) { @@ -83,6 +85,20 @@ export const ValidatorSet = { return message; }, + toJSON(message: ValidatorSet): unknown { + const obj: any = {}; + if (message.validators) { + obj.validators = message.validators.map((e) => (e ? Validator.toJSON(e) : undefined)); + } else { + obj.validators = []; + } + message.proposer !== undefined && + (obj.proposer = message.proposer ? Validator.toJSON(message.proposer) : undefined); + message.totalVotingPower !== undefined && + (obj.totalVotingPower = (message.totalVotingPower || Long.ZERO).toString()); + return obj; + }, + fromPartial(object: DeepPartial): ValidatorSet { const message = { ...baseValidatorSet } as ValidatorSet; message.validators = []; @@ -103,39 +119,31 @@ export const ValidatorSet = { } return message; }, - - toJSON(message: ValidatorSet): unknown { - const obj: any = {}; - if (message.validators) { - obj.validators = message.validators.map((e) => (e ? Validator.toJSON(e) : undefined)); - } else { - obj.validators = []; - } - message.proposer !== undefined && - (obj.proposer = message.proposer ? Validator.toJSON(message.proposer) : undefined); - message.totalVotingPower !== undefined && - (obj.totalVotingPower = (message.totalVotingPower || Long.ZERO).toString()); - return obj; - }, }; const baseValidator: object = { votingPower: Long.ZERO, proposerPriority: Long.ZERO }; export const Validator = { encode(message: Validator, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(10).bytes(message.address); + if (message.address.length !== 0) { + writer.uint32(10).bytes(message.address); + } if (message.pubKey !== undefined) { PublicKey.encode(message.pubKey, writer.uint32(18).fork()).ldelim(); } - writer.uint32(24).int64(message.votingPower); - writer.uint32(32).int64(message.proposerPriority); + if (!message.votingPower.isZero()) { + writer.uint32(24).int64(message.votingPower); + } + if (!message.proposerPriority.isZero()) { + writer.uint32(32).int64(message.proposerPriority); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): Validator { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseValidator) as Validator; + const message = { ...baseValidator } as Validator; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -160,7 +168,7 @@ export const Validator = { }, fromJSON(object: any): Validator { - const message = Object.create(baseValidator) as Validator; + const message = { ...baseValidator } as Validator; if (object.address !== undefined && object.address !== null) { message.address = bytesFromBase64(object.address); } @@ -182,6 +190,18 @@ export const Validator = { return message; }, + toJSON(message: Validator): unknown { + const obj: any = {}; + message.address !== undefined && + (obj.address = base64FromBytes(message.address !== undefined ? message.address : new Uint8Array())); + message.pubKey !== undefined && + (obj.pubKey = message.pubKey ? PublicKey.toJSON(message.pubKey) : undefined); + message.votingPower !== undefined && (obj.votingPower = (message.votingPower || Long.ZERO).toString()); + message.proposerPriority !== undefined && + (obj.proposerPriority = (message.proposerPriority || Long.ZERO).toString()); + return obj; + }, + fromPartial(object: DeepPartial): Validator { const message = { ...baseValidator } as Validator; if (object.address !== undefined && object.address !== null) { @@ -206,18 +226,6 @@ export const Validator = { } return message; }, - - toJSON(message: Validator): unknown { - const obj: any = {}; - message.address !== undefined && - (obj.address = base64FromBytes(message.address !== undefined ? message.address : new Uint8Array())); - message.pubKey !== undefined && - (obj.pubKey = message.pubKey ? PublicKey.toJSON(message.pubKey) : undefined); - message.votingPower !== undefined && (obj.votingPower = (message.votingPower || Long.ZERO).toString()); - message.proposerPriority !== undefined && - (obj.proposerPriority = (message.proposerPriority || Long.ZERO).toString()); - return obj; - }, }; const baseSimpleValidator: object = { votingPower: Long.ZERO }; @@ -227,14 +235,16 @@ export const SimpleValidator = { if (message.pubKey !== undefined) { PublicKey.encode(message.pubKey, writer.uint32(10).fork()).ldelim(); } - writer.uint32(16).int64(message.votingPower); + if (!message.votingPower.isZero()) { + writer.uint32(16).int64(message.votingPower); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): SimpleValidator { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseSimpleValidator) as SimpleValidator; + const message = { ...baseSimpleValidator } as SimpleValidator; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -253,7 +263,7 @@ export const SimpleValidator = { }, fromJSON(object: any): SimpleValidator { - const message = Object.create(baseSimpleValidator) as SimpleValidator; + const message = { ...baseSimpleValidator } as SimpleValidator; if (object.pubKey !== undefined && object.pubKey !== null) { message.pubKey = PublicKey.fromJSON(object.pubKey); } else { @@ -267,6 +277,14 @@ export const SimpleValidator = { return message; }, + toJSON(message: SimpleValidator): unknown { + const obj: any = {}; + message.pubKey !== undefined && + (obj.pubKey = message.pubKey ? PublicKey.toJSON(message.pubKey) : undefined); + message.votingPower !== undefined && (obj.votingPower = (message.votingPower || Long.ZERO).toString()); + return obj; + }, + fromPartial(object: DeepPartial): SimpleValidator { const message = { ...baseSimpleValidator } as SimpleValidator; if (object.pubKey !== undefined && object.pubKey !== null) { @@ -281,14 +299,6 @@ export const SimpleValidator = { } return message; }, - - toJSON(message: SimpleValidator): unknown { - const obj: any = {}; - message.pubKey !== undefined && - (obj.pubKey = message.pubKey ? PublicKey.toJSON(message.pubKey) : undefined); - message.votingPower !== undefined && (obj.votingPower = (message.votingPower || Long.ZERO).toString()); - return obj; - }, }; declare var self: any | undefined; @@ -298,7 +308,7 @@ var globalThis: any = (() => { if (typeof self !== "undefined") return self; if (typeof window !== "undefined") return window; if (typeof global !== "undefined") return global; - throw new Error("Unable to locate global object"); + throw "Unable to locate global object"; })(); const atob: (b64: string) => string = diff --git a/packages/stargate/src/codec/tendermint/version/types.ts b/packages/stargate/src/codec/tendermint/version/types.ts index 55cfacb1..3a018249 100644 --- a/packages/stargate/src/codec/tendermint/version/types.ts +++ b/packages/stargate/src/codec/tendermint/version/types.ts @@ -28,15 +28,19 @@ const baseApp: object = { protocol: Long.UZERO, software: "" }; export const App = { encode(message: App, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).uint64(message.protocol); - writer.uint32(18).string(message.software); + if (!message.protocol.isZero()) { + writer.uint32(8).uint64(message.protocol); + } + if (message.software !== "") { + writer.uint32(18).string(message.software); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): App { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseApp) as App; + const message = { ...baseApp } as App; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -55,7 +59,7 @@ export const App = { }, fromJSON(object: any): App { - const message = Object.create(baseApp) as App; + const message = { ...baseApp } as App; if (object.protocol !== undefined && object.protocol !== null) { message.protocol = Long.fromString(object.protocol); } else { @@ -69,6 +73,13 @@ export const App = { return message; }, + toJSON(message: App): unknown { + const obj: any = {}; + message.protocol !== undefined && (obj.protocol = (message.protocol || Long.UZERO).toString()); + message.software !== undefined && (obj.software = message.software); + return obj; + }, + fromPartial(object: DeepPartial): App { const message = { ...baseApp } as App; if (object.protocol !== undefined && object.protocol !== null) { @@ -83,28 +94,25 @@ export const App = { } return message; }, - - toJSON(message: App): unknown { - const obj: any = {}; - message.protocol !== undefined && (obj.protocol = (message.protocol || Long.UZERO).toString()); - message.software !== undefined && (obj.software = message.software); - return obj; - }, }; const baseConsensus: object = { block: Long.UZERO, app: Long.UZERO }; export const Consensus = { encode(message: Consensus, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - writer.uint32(8).uint64(message.block); - writer.uint32(16).uint64(message.app); + if (!message.block.isZero()) { + writer.uint32(8).uint64(message.block); + } + if (!message.app.isZero()) { + writer.uint32(16).uint64(message.app); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): Consensus { const reader = input instanceof Uint8Array ? new _m0.Reader(input) : input; let end = length === undefined ? reader.len : reader.pos + length; - const message = Object.create(baseConsensus) as Consensus; + const message = { ...baseConsensus } as Consensus; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -123,7 +131,7 @@ export const Consensus = { }, fromJSON(object: any): Consensus { - const message = Object.create(baseConsensus) as Consensus; + const message = { ...baseConsensus } as Consensus; if (object.block !== undefined && object.block !== null) { message.block = Long.fromString(object.block); } else { @@ -137,6 +145,13 @@ export const Consensus = { return message; }, + toJSON(message: Consensus): unknown { + const obj: any = {}; + message.block !== undefined && (obj.block = (message.block || Long.UZERO).toString()); + message.app !== undefined && (obj.app = (message.app || Long.UZERO).toString()); + return obj; + }, + fromPartial(object: DeepPartial): Consensus { const message = { ...baseConsensus } as Consensus; if (object.block !== undefined && object.block !== null) { @@ -151,13 +166,6 @@ export const Consensus = { } return message; }, - - toJSON(message: Consensus): unknown { - const obj: any = {}; - message.block !== undefined && (obj.block = (message.block || Long.UZERO).toString()); - message.app !== undefined && (obj.app = (message.app || Long.UZERO).toString()); - return obj; - }, }; type Builtin = Date | Function | Uint8Array | string | number | undefined | Long; diff --git a/yarn.lock b/yarn.lock index 92862eb5..a2ac247f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8654,16 +8654,24 @@ ts-poet@^4.5.0: lodash "^4.17.15" prettier "^2.0.2" -ts-proto@=1.61.0: - version "1.61.0" - resolved "https://registry.yarnpkg.com/ts-proto/-/ts-proto-1.61.0.tgz#0ae36097f52b0be2dae3481e34b2436ab7e44564" - integrity sha512-F7FnsOPn22ij6fI3E+1lnOVEhYyILpYk1DLpqEEHVOF77ctA5Jz11G9DtwxWTqzlQ0mAvCEWkAhwdCNa0p7CBQ== +ts-proto-descriptors@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/ts-proto-descriptors/-/ts-proto-descriptors-1.2.0.tgz#47fdef5dc640d2c87fbe0c010678f009e79f63bc" + integrity sha512-0t2WITzCiQ/3H6zPuFrFFOj2jhH6xZNu7agS7aKecKrz7tjRMW9VrmlBlJXslTTC3K7/4phV4qlsP5fOfLxuDg== + dependencies: + protobufjs "^6.8.8" + +ts-proto@^1.67.0: + version "1.67.0" + resolved "https://registry.yarnpkg.com/ts-proto/-/ts-proto-1.67.0.tgz#27c45852e5640daa260750a91341026e49dfce40" + integrity sha512-+a7zleIP3EuZucu8B/HgSqzZarYHSeZ9z2KYK0/P9K8meSuLKBFB5yipYU0VK78FxAdX+u//ZTGvwe2Pzq1XfA== dependencies: "@types/object-hash" "^1.3.0" dataloader "^1.4.0" object-hash "^1.3.1" protobufjs "^6.8.8" ts-poet "^4.5.0" + ts-proto-descriptors "^1.2.0" tsconfig-paths@^3.9.0: version "3.9.0"